');
var nonce=jQuery('#wprentals_update_profile_nonce').val();
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_update_profile',
'firstname':firstname,
'secondname':secondname,
'useremail':useremail,
'userphone':userphone,
'usermobile':usermobile,
'userskype':userskype,
'description':description,
'upload_picture':upload_picture,
'security-profile':securityprofile,
'profile_image_url':profile_image_url,
'profile_image_url_small':profile_image_url_small,
'user_id_url':useridurl,
'user_id_image_id':useridimageid,
'userfacebook':userfacebook,
'userviber':userviber,
'uservkontakte':uservkontakte,
'userwhatsapp':userwhatsapp,
'usertelegram':usertelegram,
'usertwitter':usertwitter,
'userlinkedin':userlinkedin,
'userpinterest':userpinterest,
'live_in':live_in,
'i_speak':i_speak,
'paypal_payments_to': paypal_payments_to,
'payment_info':payment_info,
'security':nonce,
'instagram':instagram,
'youtube':youtube,
'userwebsite':userwebsite,
},
success: function (data){
$('#profile_message').empty().append('
' + data + '
');
},
error: function (errorThrown){
}});
});
$('#delete_profile').on('click',function (){
var ajaxurl;
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
var result=confirm(ajaxcalls_vars.delete_account);
if(result){
var nonce=jQuery('#wprentals_update_profile_nonce').val();
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_delete_profile',
'security':nonce
},
success: function (data){
window.location='/';
},
error: function (errorThrown){
}});
}});
});
wprentals_map_type=parseInt(mapbase_vars.wprentals_map_type);
var lealet_map_move_on_hover=0;
var propertyMarker_submit='';
var leaflet_map_move_flag=0;
function wprentals_map_general_start_map(page_map){
"use strict";
var zoom_level;
if(page_map=='prop'){
zoom_level=parseInt(googlecode_property_vars.page_custom_zoom, 10);
}else{
zoom_level=parseInt(googlecode_regular_vars.page_custom_zoom, 10);
}
if(wprentals_map_type===1){
wprentals_google_start_map(zoom_level);
}else if(wprentals_map_type===2){
wprentals_leaflet_start_map(zoom_level);
}else if(wprentals_map_type===3){
}}
function wprentals_map_general_set_markers(map, markers){
"use strict";
wprentals_google_setMarkers2(map, markers);
}
function wprentals_map_general_cluster(){
"use strict";
if(wprentals_map_type===1){
wprentals_google_map_cluster();
}else if(wprentals_map_type===2){
wprentals_leaflet_map_cluster();
}else if(wprentals_map_type===3){
}}
function wprentals_leaflet_map_cluster(){
"use strict";
map.addLayer(markers_cluster);
}
function wprentals_map_general_fit_to_bounds(){
"use strict";
if(wprentals_map_type===1){
wprentals_google_fit_to_bounds();
}else if(wprentals_map_type===2){
wprentals_leaflet_fit_to_bounds();
}else if(wprentals_map_type===3){
}}
function wprentals_map_general_map_pan_move(){
"use strict";
if(wprentals_map_type===1){
wprentals_google_map_pan_move();
}else if(wprentals_map_type===2){
wprentals_leaflet_map_pan_move();
}else if(wprentals_map_type===3){
}}
function wprentals_leaflet_start_map(zoom_level){
"use strict";
if(typeof(curent_gview_long)==='undefined'||curent_gview_lat===''||curent_gview_long==='0'){
if(typeof(googlecode_property_vars)!=='undefined'){
curent_gview_lat=googlecode_property_vars.general_latitude;
}
if(typeof(googlecode_regular_vars)!=='undefined'){
curent_gview_lat=googlecode_regular_vars.general_latitude;
}}
if(typeof(curent_gview_long)==='undefined'||curent_gview_long===''||curent_gview_long==='0'){
if(typeof(googlecode_property_vars)!=='undefined'){
curent_gview_long=googlecode_property_vars.general_longitude;
}
if(typeof(googlecode_regular_vars)!=='undefined'){
curent_gview_long=googlecode_regular_vars.general_longitude;
}}
var mapCenter=L.latLng(curent_gview_lat,curent_gview_long);
if(document.getElementById('googleMap')){
map=L.map('googleMap',{
center: mapCenter,
zoom: zoom_level,
}).on('load', function(e){
jQuery('#gmap-loading').remove();
});
}else if(document.getElementById('google_map_prop_list')){
map=L.map('google_map_prop_list',{
center: mapCenter,
zoom: zoom_level
}).on('load', function(e){
jQuery('#gmap-loading').remove();
});
}else if(document.getElementById('google_map_on_list')){
map=L.map('google_map_on_list',{
center: mapCenter,
zoom: zoom_level
}).on('load', function(e){
jQuery('#gmap-loading').remove();
});
map_intern=1;
}
var tileLayer=wprentals_open_stret_tile_details();
map.addLayer(tileLayer);
map.scrollWheelZoom.disable();
if(Modernizr.mq('only all and (max-width: 768px)')){
map.dragging.disable();
}
map.on('popupopen', function(e){
lealet_map_move_on_hover=1;
if(jQuery('#google_map_prop_list_wrapper').length==0){
var px=map.project(e.popup._latlng);
if(mapfunctions_vars.useprice==='yes'){
px.y -=115;
}else{
px.y -=320/2;
}
map.panTo(map.unproject(px),{animate: true});
}
lealet_map_move_on_hover=1;
});
map.on('load', function(e){
jQuery('#gmap-loading').remove();
});
if(Modernizr.mq('only all and (max-width: 768px)')){
map.on('dblclick ', function(e){
if(map.dragging.enabled()){
map.dragging.disable();
}else{
map.dragging.enable();
}});
}
markers_cluster=L.markerClusterGroup({
iconCreateFunction: function(cluster){
return L.divIcon({ html: '
' + cluster.getChildCount() + '
' });
},
});
}
function wprentals_open_stret_tile_details(){
"use strict";
if(mapbase_vars.wp_estate_mapbox_api_key===''){
var tileLayer=L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '©
OpenStreetMap contributors'
});
}else{
var tileLayer=L.tileLayer('https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token='+mapbase_vars.wp_estate_mapbox_api_key, {
attribution: '©
OpenStreetMap contributors',
maxZoom: 18,
id: 'mapbox.streets',
accessToken: 'your.mapbox.access.token'
}
);
}
return tileLayer;
}
function wprentals_google_start_map(zoom_level){
"use strict";
var mapOptions, styles;
if(typeof(curent_gview_long)==='undefined'||curent_gview_lat===''||curent_gview_lat==='0'){
if(typeof(googlecode_property_vars)!=='undefined'){
curent_gview_lat=googlecode_property_vars.general_latitude;
}
if(typeof(googlecode_regular_vars)!=='undefined'){
curent_gview_lat=googlecode_regular_vars.general_latitude;
}}
if(typeof(curent_gview_long)==='undefined'||curent_gview_long===''||curent_gview_long==='0'){
if(typeof(googlecode_property_vars)!=='undefined'){
curent_gview_long=googlecode_property_vars.general_longitude;
}
if(typeof(googlecode_regular_vars)!=='undefined'){
curent_gview_long=googlecode_regular_vars.general_longitude;
}}
mapOptions={
flat: false,
noClear: false,
zoom: zoom_level,
scrollwheel: false,
draggable: true,
maxZoom:18,
center: new google.maps.LatLng(curent_gview_lat, curent_gview_long),
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP]
},
disableDefaultUI: true,
gestureHandling: 'cooperative'
};
if(document.getElementById('googleMap')){
map=new google.maps.Map(document.getElementById('googleMap'), mapOptions);
}else if(document.getElementById('google_map_prop_list')){
mapOptions['minZoom']=4;
map=new google.maps.Map(document.getElementById('google_map_prop_list'), mapOptions);
}else if(document.getElementById('google_map_on_list')){
map=new google.maps.Map(document.getElementById('google_map_on_list'), mapOptions);
map_intern=1;
}else{
return;
}
bounds_list=new google.maps.LatLngBounds();
google.maps.visualRefresh=true;
if(mapfunctions_vars.map_style!==''){
styles=JSON.parse(mapfunctions_vars.map_style);
map.setOptions({styles: styles});
}
google.maps.event.addListener(map, 'tilesloaded', function (){
jQuery('#gmap-loading').remove();
});
google.maps.event.addListener(map, 'tilesloaded', function (){
jQuery('#gmap-loading').remove();
});
if(Modernizr.mq('only all and (max-width: 1025px)')){
map.setOptions({'draggable': false});
}
if(document.getElementById('googleMap')){
google.maps.event.addDomListener(document.getElementById('googleMap'), 'mousewheel', scrollwhel);
google.maps.event.addDomListener(document.getElementById('googleMap'), 'DOMMouseScroll', scrollwhel);
}
if(document.getElementById('google_map_prop_list')){
google.maps.event.addDomListener(document.getElementById('google_map_prop_list'), 'mousewheel', scrollwhel);
google.maps.event.addDomListener(document.getElementById('google_map_prop_list'), 'DOMMouseScroll', scrollwhel);
}
function scrollwhel(event){
if(map.scrollwheel===true){
event.stopPropagation();
}}
}
function wprentals_leaflet_fit_to_bounds(){
"use strict";
if(typeof(bounds_list)!='undefined'&&bounds_list.isValid()){
if(mapfunctions_vars.bypass_fit_bounds!=='1'){
wpestate_fit_bounds_leaflet(bounds_list);
}}else{
wpestate_fit_bounds_nolsit_leaflet();
}}
function wprentals_google_fit_to_bounds(){
"use strict";
if(document.getElementById('google_map_prop_list')){
if(!bounds_list.isEmpty()){
if(mapfunctions_vars.bypass_fit_bounds!=='1'){
wpestate_fit_bounds(bounds_list);
}}else{
wpestate_fit_bounds_nolsit();
}}else if(document.getElementById('googleMap')){
if(!bounds_list.isEmpty()){
if(mapfunctions_vars.bypass_fit_bounds!=='1'){
wpestate_fit_bounds(bounds_list);
}}else{
wpestate_fit_bounds_nolsit();
}}
}
function wprentals_map_general_spiderfy(){
"use strict";
if(wprentals_map_type===1){
oms=new OverlappingMarkerSpiderfier(map, {markersWontMove: true, markersWontHide: true, keepSpiderfied: true, legWeight: 3});
setOms(gmarkers);
}else if(wprentals_map_type===2){
}else if(wprentals_map_type===3){
}}
function wprentals_leaflet_map_pan_move(){
"use strict";
if(googlecode_regular_vars.on_demand_pins==='yes'&&mapfunctions_vars.is_tax!=1&&mapfunctions_vars.is_property_list==='1'){
map.on('moveend', function(e){
wpestate_ondenamd_map_moved_leaflet();
});
}}
function wprentals_google_map_pan_move(){
"use strict";
if(googlecode_regular_vars.on_demand_pins==='yes'&&mapfunctions_vars.is_tax!=1&&mapfunctions_vars.is_property_list==='1'){
map.addListener('idle', function(){
wpestate_ondenamd_map_moved();
});
}}
function wprentals_google_setMarkers2 (map, locations){
"use strict";
var selected_id=parseInt(jQuery('#gmap_wrapper').attr('data-post_id'), 10);
if(isNaN(selected_id)){
selected_id=parseInt(jQuery('#google_map_on_list').attr('data-post_id'), 10);
}
var open_height=parseInt(mapfunctions_vars.open_height, 10);
var closed_height=parseInt(mapfunctions_vars.closed_height, 10);
var width_browser=jQuery(window).width();
infobox_width=700;
vertical_pan=-215;
if(width_browser < 900){
infobox_width=500;
}
if(width_browser < 600){
infobox_width=400;
}
if(width_browser < 400){
infobox_width=200;
}
var i;
for (i=0; i < locations.length; i++){
var beach=locations[i];
var id=beach[10];
var lat=beach[1];
var lng=beach[2];
var title=decodeURIComponent(beach[0]);
var pin=beach[8];
var counter=beach[3];
var image=decodeURIComponent(beach[4]);
var price=decodeURIComponent(beach[5]);
var single_first_type=decodeURIComponent(beach[6]);
var single_first_action=decodeURIComponent(beach[7]);
var link=decodeURIComponent(beach[9]);
var city=decodeURIComponent(beach[11]);
var area=decodeURIComponent(beach[12]);
var cleanprice=beach[13];
var rooms=beach[14];
var baths=beach[15];
var size=beach[16];
var single_first_type_name=decodeURIComponent(beach[17]);
var single_first_action_name=decodeURIComponent(beach[18]);
var status=decodeURIComponent(beach[19]);
var pin_price=decodeURIComponent(beach[20]);
var custom_info=decodeURIComponent(beach[21]);
if(selected_id===id){
found_id=i;
}
if(wprentals_map_type===1){
wprentals_createMarker_google(pin_price,infobox_width ,size, i, id, lat, lng, pin, title, counter, image, price, single_first_type, single_first_action, link, city, area, rooms, baths, cleanprice, single_first_type_name, single_first_action_name,status,custom_info);
}else if(wprentals_map_type===2){
wprentals_createMarker_leaflet(pin_price,infobox_width ,size, i, id, lat, lng, pin, title, counter, image, price, single_first_type, single_first_action, link, city, area, rooms, baths, cleanprice, single_first_type_name, single_first_action_name,status,custom_info);
}else if(wprentals_map_type===3){
}}
}
function wprentals_createMarker_google(pin_price,infobox_width, size, i, id, lat, lng, pin, title, counter, image, price, single_first_type, single_first_action, link, city, area, rooms, baths, cleanprice, single_first_type_name, single_first_action_name,status,custom_info){
"use strict";
var marker, myLatLng;
var Titlex=jQuery('
').html(title).text();
var infobox_class="";
var poss=0;
var boxText=document.createElement("div");
var myOptions={
content: boxText,
disableAutoPan: true,
maxWidth: infobox_width,
boxClass: "mybox",
zIndex: null,
closeBoxMargin: "-13px 0px 0px 0px",
closeBoxURL: "",
infoBoxClearance: new google.maps.Size(1, 1),
isHidden: false,
pane: "floatPane",
enableEventPropagation: false
};
infoBox=new InfoBox(myOptions);
myLatLng=new google.maps.LatLng(lat, lng);
if(mapfunctions_vars.useprice==='yes'&&mapfunctions_vars.hidden_map){
infobox_class=" pin_price_info ";
var myLatlng=new google.maps.LatLng(lat,lng);
marker=new WpstateMarker(
area,
city,
pin_price,
poss,
myLatlng,
map,
Titlex,
counter,
image,
id,
price,
single_first_type,
single_first_action,
link,
i,
rooms,
baths,
cleanprice,
size,
single_first_type_name,
single_first_action_name,
pin,
custom_info
);
}else{
infobox_class=" classic_info ";
marker=new google.maps.Marker({
position: myLatLng,
map: map,
icon: custompin(pin),
custompin: pin,
shape: shape,
title: title,
zIndex: counter,
image: image,
idul: id,
price: price,
category: single_first_type,
action: single_first_action,
link: link,
city: city,
area: area,
infoWindowIndex: i,
rooms: rooms,
guest_no: baths,
cleanprice: cleanprice,
size: size,
category_name: single_first_type_name,
action_name: single_first_action_name,
status:status,
custom_info:custom_info
});
}
gmarkers.push(marker);
if(typeof (bounds_list)!=="undefined"){
bounds_list.extend(marker.getPosition());
}
google.maps.event.addListener(marker, 'click', function (event){
var title, info_image, category, action, category_name, action_name, in_type, infoguest, inforooms, vertical_off, status_html,status;
wpestate_new_open_close_map(1);
external_action_ondemand=1;
if(this.image===''){
info_image=mapfunctions_vars.path + '/idxdefault.jpg';
}else{
info_image=this.image;
}
if(typeof(this.status)!='undefined'){
if(this.status.indexOf('%')!==-1){
status=this.status;
}else{
status=decodeURIComponent(this.status.replace(/-/g, ' '));
}}else{
status='';
}
category=decodeURIComponent(this.category.replace(/-/g, ' '));
action=decodeURIComponent(this.action.replace(/-/g, ' '));
category_name=decodeURIComponent(this.category_name.replace(/-/g, ' '));
action_name=decodeURIComponent(this.action_name.replace(/-/g, ' '));
status_html=wpestate_display_status(status);
in_type=mapfunctions_vars.in_text;
if(category===''||action===''){
in_type=" ";
}
in_type=" / ";
if(this.guest_no!==''){
infoguest='
' + this.guest_no + ' ';
}else{
infoguest='';
}
if(this.rooms!==''){
inforooms='
' + this.rooms + ' ';
}else{
inforooms='';
}
title=this.title.toString();
if(this.custom_info!=='undefined'){
var custom_array=this.custom_info.split(',');
inforooms='
' + custom_array[1] + '';
infoguest='
' + custom_array[3] + '';
}
infoBox.setContent('
'+status_html+'
' + title + ' ' + category_name + '
' + infoguest + inforooms + '
' + this.price + '
');
if(mapfunctions_vars.hidden_map){
infoBox.open(map, this);
}
map.setCenter(this.position);
switch (infobox_width){
case 700:
if(!document.getElementById('google_map_on_list')){
if(mapfunctions_vars.listing_map==='top'){
if(document.getElementById('google_map_prop_list')){
map.panBy(0, -100);
}else{
map.panBy(100, -100);
}}else{
map.panBy(10, -110);
}}else{
if(mapfunctions_vars.hidden_map){
map.panBy(0, -160);
}}
vertical_off=0;
break;
case 500:
if(document.getElementById('google_map_prop_list')){
map.panBy(50, -120);
}else{
map.panBy(50, -150);
}
break;
case 400:
if(document.getElementById('google_map_prop_list')){
map.panBy(100, -220);
}else{
map.panBy(0, -150);
}
break;
case 200:
map.panBy(20, -170);
break;
}
if(control_vars.show_adv_search_map_close==='no'){
$('.search_wrapper').addClass('adv1_close');
adv_search_click();
}
wpestate_close_adv_search();
});/////////////////////////////////// end event listener
if(mapfunctions_vars.generated_pins!=='0'){
if(map_is_pan===0){
wpestate_pan_to_last_pin(myLatLng);
}
map_is_pan=1;
}}
function wprentals_createMarker_leaflet(pin_price,infobox_width, size, i, id, lat, lng, pin, title, counter, image, price, single_first_type, single_first_action, link, city, area, rooms, guest_no, cleanprice, single_first_type_name, single_first_action_name,status,custom_info){
"use strict";
var infoboxWrapper=document.createElement("div");
infoboxWrapper.className='leafinfobox-wrapper';
var infobox="";
var infobox_class=" classic_info ";
if(mapfunctions_vars.useprice==='yes'){
infobox_class=' openstreet_map_price_infobox ';
}
if(typeof(status)!='undefined'){
if(status.indexOf('%')!==-1){
}else{
status=decodeURIComponent(status.replace(/-/g, ' '));
}}else{
status='';
}
var status_html=wpestate_display_status(status);
var info_image='';
if(image===''){
info_image=mapfunctions_vars.path + '/idxdefault.jpg';
}else{
info_image=image;
}
var category=decodeURIComponent(single_first_type.replace(/-/g, ' '));
var action=decodeURIComponent(single_first_action.replace(/-/g, ' '));
var category_name=decodeURIComponent(single_first_type_name.replace(/-/g, ' '));
var action_name=decodeURIComponent(single_first_action_name.replace(/-/g, ' '));
var in_type=mapfunctions_vars.in_text;
if(category===''){
in_type=" ";
}
in_type=" / ";
var infoguest,inforooms;
if(guest_no!==''){
infoguest='
' + guest_no + ' ';
}else{
infoguest='';
}
if(size!==''){
inforooms='
' + size + ' ';
}else{
inforooms='';
}
title=title.toString();
if(custom_info!=='undefined'){
var custom_array=custom_info.split(',');
inforooms='
' + custom_array[1] + '';
infoguest='
' + custom_array[3] + '';
}
infobox +='
'+status_html+'
' + title + ' ' + category_name + '
' + infoguest + inforooms + '
' + price + '
';
var markerOptions={
riseOnHover: true
};
var markerCenter=L.latLng(lat, lng);
var propertyMarker='';
if(!mapfunctions_vars.hidden_map){
propertyMarker=L.circle(markerCenter, {
color: 'red',
fillColor: '#b881fc',
fillOpacity: 0.4,
strokeWeight: 0.4,
radius: 120
});
}else{
if(mapfunctions_vars.useprice==='yes'){
var price_pin_class='wpestate_marker openstreet_price_marker '+wpestate_makeSafeForCSS(single_first_type_name.trim())+' '+wpestate_makeSafeForCSS(single_first_action_name.trim());
var pin_price_marker='
';
if(typeof(price)!=='undefined'){
if(mapfunctions_vars.use_price_pins_full_price==='no'){
pin_price_marker +='
'+pin_price+'
';
}else{
pin_price_marker +='
'+price+'
';
}}
pin_price_marker +='
';
var myIcon=L.divIcon({
className:'someclass',
iconSize: new L.Point(0, 0),
html: pin_price_marker
});
propertyMarker=L.marker(markerCenter, {icon: myIcon});
}else{
var markerImage={
iconUrl: wprentals_custompin_leaflet(pin),
iconSize: [44, 50],
iconAnchor: [20, 50],
popupAnchor: [1, -50]
};
markerOptions.icon=L.icon(markerImage);
propertyMarker=L.marker(markerCenter, markerOptions);
}}
propertyMarker.idul=id;
propertyMarker.pin=pin;
if(mapfunctions_vars.user_cluster==='yes'){
markers_cluster.addLayer(propertyMarker);
}else{
propertyMarker.addTo(map);
}
gmarkers.push(propertyMarker);
if(typeof (bounds_list)!=="undefined"){
bounds_list.extend(propertyMarker.getLatLng());
}else{
bounds_list=L.latLngBounds(propertyMarker.getLatLng(),propertyMarker.getLatLng());
}
infoboxWrapper.innerHTML=infobox;
propertyMarker.bindPopup(infobox);
if(mapfunctions_vars.generated_pins!=='0'){
if(map_is_pan===0){
wpestate_pan_to_last_pin(markerCenter);
}
map_is_pan=1;
}}
function wprentals_custompinchild_leaflet(image){
"use strict";
var custom_img;
var extension='';
var ratio=jQuery(window).dense('devicePixelRatio');
if(ratio>1){
extension='_2x';
}
if(images['userpin']===''){
custom_img=mapfunctions_vars.path + '/' + 'userpin' +extension+ '.png';
}else{
custom_img=images['userpin'];
if(ratio>1){
custom_img=custom_img.replace(".png","_2x.png");
}}
return custom_img;
}
function wprentals_custompin_leaflet(image){
"use strict";
if(mapfunctions_vars.useprice==='yes'){
return mapfunctions_vars.path + '/pixel.png';
}
var custom_img='';
var extension='';
var ratio=jQuery(window).dense('devicePixelRatio');
if(ratio>1){
extension='_2x';
}
if(mapfunctions_vars.use_single_image_pin==='no'){
if(image!==''){
if(images[image]===''){
custom_img=mapfunctions_vars.path + '/' + image + extension + '.png';
}else{
custom_img=images[image];
if(ratio>1){
custom_img=wpestate_get_custom_retina_pin(custom_img);
}}
}else{
custom_img=images['single_pin'];
}}else{
if(ratio>1){
custom_img=wpestate_get_custom_retina_pin(images['single_pin']);
}else{
custom_img=images['single_pin'];
}}
return custom_img;
}
function wprentals_map_resize(){
"use strict";
if(wprentals_map_type===1){
google.maps.event.trigger(map, "resize");
}else if(wprentals_map_type===2){
map.invalidateSize();
}else if(wprentals_map_type===3){
}}
wprentals_autocomplete_mapbox();
function wprentals_autocomplete_mapbox(){
"use strict";
if(parseInt(mapbase_vars.wprentals_places_type)!==2){
return;
}
if(document.getElementById('property_city_front')){
if(parseInt(mapbase_vars.wprentals_places_type)==2){
var placesAutocomplete=places({
appId: mapbase_vars.wp_estate_algolia_app_id,
apiKey: mapbase_vars.wp_estate_algolia_api_key,
type: 'city',
language: 'en',
templates: {
value: function(suggestion){
return suggestion.name;
}},
container: document.querySelector('#property_city_front')
});
placesAutocomplete.on('change', function(e){
wprentals_agolia_fillInAddress_city(e);
});
}}
if(document.getElementById('property_address')){
var address, full_addr, country, city, infowindow;
address=document.getElementById('property_address').value;
city=jQuery("#property_city_submit").val();
full_addr=address + ',' + city;
country=document.getElementById('property_country').value;
if(country){
full_addr=full_addr + ',' + country;
}
var placesAutocomplete=places({
appId: mapbase_vars.wp_estate_algolia_app_id,
apiKey: mapbase_vars.wp_estate_algolia_api_key,
type: 'address',
language: 'en',
templates: {
value: function(suggestion){
return suggestion.name;
}},
container: document.querySelector('#property_address')
});
placesAutocomplete.on('change', function(place){
wprentals_submit_agolia_codeAddress(place.suggestion.latlng.lat,place.suggestion.latlng.lng);
});
}
if(document.getElementById('geolocation_search')){
var placesAutocomplete=places({
appId: mapbase_vars.wp_estate_algolia_app_id,
apiKey: mapbase_vars.wp_estate_algolia_api_key,
language: 'en',
templates: {
value: function(suggestion){
return suggestion.name;
}},
container: document.querySelector('#geolocation_search')
});
placesAutocomplete.on('change', function(place){
initial_geolocation_circle_flag=0;
jQuery("#geolocation_lat").val(place.suggestion.latlng.lat);
jQuery("#geolocation_long").val(place.suggestion.latlng.lng);
wpestate_start_filtering_ajax_map(1);
});
}
var search_fields=['search_location', 'search_locationshortcode', 'search_locationmobile','search_locationsidebar'];
search_fields.forEach(function(element){
if(document.getElementById(element)&&document.getElementById(element).getAttribute("type")=="text"){
var placesAutocomplete=places({
appId: mapbase_vars.wp_estate_algolia_app_id,
apiKey: mapbase_vars.wp_estate_algolia_api_key,
type: 'city',
language: 'en',
templates: {
value: function(suggestion){
return suggestion.name;
}},
container: document.querySelector('#'+element)
});
placesAutocomplete.on('change', function(place){
wprentals_fillInAddress_filter_leaflet(place,element);
});
}});
}
function wprentals_fillInAddress_filter_leaflet(place,element){
"use strict";
var i, addressType, val, have_city,admin_area,property_country,property_area,property_city;
have_city=0;
admin_area='';
var extension='';
if(element=='search_locationshortcode'){
extension='shortcode';
}else if(element=='search_locationmobile'){
extension='mobile';
}else if(element=='search_locationsidebar'){
extension='sidebar';
}
if(typeof(place.suggestion.administrative)!=='undefined'){
admin_area=admin_area+place.suggestion.administrative;
}
if(typeof(place.suggestion.county)!=='undefined'){
admin_area=admin_area+', '+place.suggestion.county;
}
jQuery('#property_admin_area,#property_admin_areasidebar,#property_admin_areashortcode,#property_admin_areamobile').val(admin_area);
if(typeof(place.suggestion.country)!=='undefined'){
property_country=place.suggestion.country;
jQuery('#advanced_country'+extension).attr('data-value', property_country);
jQuery('#advanced_country'+extension).val(property_country);
jQuery('#search_location_country'+extension).val(property_country);
}
if(place.suggestion.type=='city'){
property_city=place.suggestion.value;
jQuery('#advanced_city'+extension).attr('data-value', property_city);
jQuery('#advanced_city'+extension).val(property_city);
jQuery('#search_location_city'+extension).val(property_city);
}
if(place.suggestion.type=='address'){
property_area=place.suggestion.address;
jQuery('#advanced_area'+extension).attr('data-value', property_area);
jQuery('#advanced_area'+extension).val(property_area);
jQuery('#search_location_area'+extension).val(property_area);
}
if(jQuery('#advanced_search_map_list').length>0){
wpestate_start_filtering_ajax_map(1);
}
var is_google_map=parseFloat(jQuery('#isgooglemap').attr('data-isgooglemap'), 10);
if(is_google_map===1){
var guest_val=jQuery(this).attr('data-value');
}}
function wprentals_agolia_fillInAddress_city(place){
"use strict";
var admin_area='';
var property_city='';
var property_country='';
if(typeof(place.suggestion.administrative)!=='undefined'){
admin_area=admin_area+place.suggestion.administrative;
}
if(typeof(place.suggestion.county)!=='undefined'){
admin_area=admin_area+', '+place.suggestion.county;
}
if(typeof(place.suggestion.country)!=='undefined'){
property_country=place.suggestion.country;
}
if(typeof(place.suggestion.value)!=='undefined'){
property_city=place.suggestion.value;
}
jQuery('#property_city').val(property_city);
jQuery('#property_country').val(property_country);
jQuery('#property_admin_area').val(property_city+", "+admin_area);
}
function wprentals_initialize_map_submit_leaflet(){
"use strict";
var listing_lat=jQuery('#property_latitude').val();
var listing_lon=jQuery('#property_longitude').val();
if(listing_lat===''||listing_lat===0||listing_lat==='0'){
listing_lat=google_map_submit_vars.general_latitude;
}
if(listing_lon===''||listing_lon===0||listing_lon==='0'){
listing_lon=google_map_submit_vars.general_longitude;
}
var mapCenter=L.latLng(listing_lat,listing_lon);
if(document.getElementById('googleMapsubmit')){
map=L.map('googleMapsubmit',{
center: mapCenter,
zoom: 17
}).on('load', function(e){
});
var tileLayer=wprentals_open_stret_tile_details();
map.addLayer(tileLayer);
map.on('click', function(e){
map.removeLayer(propertyMarker_submit);
var markerCenter=L.latLng(e.latlng);
propertyMarker_submit=L.marker(e.latlng).addTo(map);
propertyMarker_submit.bindPopup('
Latitude: ' + e.latlng.lat + ' Longitude: ' + e.latlng.lng+'
').openPopup();
document.getElementById("property_latitude").value=e.latlng.lat ;
document.getElementById("property_longitude").value=e.latlng.lng;
});
var markerCenter=L.latLng(listing_lat,listing_lon);
propertyMarker_submit=L.marker(markerCenter).addTo(map);
propertyMarker_submit.bindPopup('
Latitude: ' + listing_lat + ' Longitude: ' + listing_lon+'
').openPopup();
}}
function wprentals_submit_agolia_codeAddress(listing_lat,listing_lon){
"use strict";
if(parseInt(mapbase_vars.wprentals_map_type)==1){
wprentals_submit_set_postion(listing_lat,listing_lon);
}else if(parseInt(mapbase_vars.wprentals_map_type)==2){
map.removeLayer(propertyMarker_submit);
var markerCenter=L.latLng(listing_lat,listing_lon);
propertyMarker_submit=L.marker(markerCenter).addTo(map);
map.setView(markerCenter, 15);
propertyMarker_submit.bindPopup('
Latitude: ' + listing_lat + ' Longitude: ' + listing_lon+'
').openPopup();
document.getElementById("property_latitude").value=listing_lat ;
document.getElementById("property_longitude").value=listing_lon;
}}
function wprentals_submit_set_postion(listing_lat,listing_long){
"use strict";
wpestate_removeMarkers();
var myLatLng=new google.maps.LatLng(listing_lat, listing_long);
map.setCenter(myLatLng);
var marker=new google.maps.Marker({
map: map,
position: myLatLng
});
gmarkers.push(marker);
var infowindow=new google.maps.InfoWindow({
content: 'Latitude: ' + listing_lat + '
Longitude: ' + listing_long
});
infowindow.open(map,marker);
document.getElementById("property_latitude").value=listing_lat ;
document.getElementById("property_longitude").value=listing_long;
}
function wpestate_display_status(status){
var status_html='';
if(status!=='normal'&&status!==''){
var status_array=status.split(",");
for (var i=0; i < status_array.length; i++){
status_html=status_html+'
'+status_array[i]+'
';
}}
return status_html='
'+status_html+'
';
};
var gmarkers=[];
var current_place=0;
var actions=[];
var categories=[];
var vertical_pan=-190;
var map_open=0;
var vertical_off=150;
var pins='';
var markers='';
var infoBox=null;
var category=null;
var width_browser=null;
var infobox_width=null;
var wraper_height=null;
var info_image=null;
var map;
var found_id;
var selected_id=jQuery('#gmap_wrapper').attr('data-post_id');
var heading=0;
var panorama;
var oms;
var map_intern=0;
var external_action_ondemand=0;
var is_fit_bounds_zoom=0;
var map_geo_first_load=0;
var markers_cluster;
var is_drag_end=0;
var is_zoom_end=0;
function wprentals_initialize_map(){
"use strict";
var viewPlace, mapOptions, mapOptions_intern, styles;
wprentals_map_general_start_map('prop');
if(map_intern===0){
if(googlecode_property_vars.generated_pins==='0'){
pins=googlecode_property_vars.markers;
markers=jQuery.parseJSON(pins);
}else{
if(typeof (googlecode_regular_vars2)!=='undefined'&&googlecode_regular_vars2.markers2.length > 2){
pins=googlecode_regular_vars2.markers2;
markers=jQuery.parseJSON(pins);
}}
if(markers.length > 0){
wprentals_map_general_set_markers(map, markers);
}
wprentals_map_general_cluster();
}else{
pins=googlecode_property_vars.single_marker;
markers=jQuery.parseJSON(pins);
if(markers.length > 0){
wprentals_map_general_set_markers(map, markers);
}
curent_gview_lat=jQuery('#google_map_on_list').attr('data-cur_lat');
curent_gview_long=jQuery('#google_map_on_list').attr('data-cur_long');
if(parseInt(mapbase_vars.wprentals_map_type)===1){
google.maps.event.trigger(gmarkers[0], 'click');
}else{
gmarkers[0].addTo(map);
map.panTo(gmarkers[0].getLatLng());
if(mapfunctions_vars.hidden_map){
gmarkers[0].fire('click').openPopup();
}}
}
function scrollwhel(event){
if(map.scrollwheel===true){
event.stopPropagation();
}}
wprentals_map_general_spiderfy();
wpestate_initialize_poi(map, 1);
}
if(typeof google==='object'&&typeof google.maps==='object'){
google.maps.event.addDomListener(window, 'load', wprentals_initialize_map);
}else{
wprentals_initialize_map();
}
function wpestate_toggleStreetView(){
"use strict";
var curent_gview_lat=jQuery('#google_map_on_list').attr('data-cur_lat');
var curent_gview_long=jQuery('#google_map_on_list').attr('data-cur_long');
var viewPlace=new google.maps.LatLng(curent_gview_lat, curent_gview_long);
panorama=map.getStreetView();
panorama.setPosition(viewPlace);
heading=parseInt(googlecode_property_vars.camera_angle, 10);
panorama.setPov(({
heading: heading,
pitch: 0
}));
panorama.addListener('visible_changed', function(){
if(!panorama.visible){
jQuery('#gmap-next,#gmap-prev ,#geolocation-button,#gmapzoomminus,#gmapzoomplus,#gmapstreet').show();
jQuery('#street-view').removeClass('mapcontrolon');
jQuery('#street-view').html('
' + control_vars.street_view_on);
}});
if(panorama.visible){
panorama.setVisible(false);
jQuery('#gmap-next,#gmap-prev ,#geolocation-button,#gmapzoomminus,#gmapzoomplus,#gmapstreet').show();
jQuery('#street-view').removeClass('mapcontrolon');
jQuery('#street-view').html('
' + control_vars.street_view_on);
}else{
panorama.setVisible(true);
jQuery('#gmap-next,#gmap-prev ,#geolocation-button,#gmapzoomminus,#gmapzoomplus,#gmapstreet').hide();
jQuery('#street-view').addClass('mapcontrolon');
jQuery('#street-view').html('
' + control_vars.street_view_off);
}};
var has_transparent=0;
var componentForm;
var price_array;
var my_custom_curr_symbol=wprentals_getCookie('my_custom_curr_symbol');
var my_custom_curr_coef=parseFloat(wprentals_getCookie('my_custom_curr_coef'), 10);
var my_custom_curr_pos=parseFloat(wprentals_getCookie('my_custom_curr_pos'), 10);
var my_custom_curr_cur_post=wprentals_getCookie('my_custom_curr_cur_post');
var my_custom_curr_label=wprentals_getCookie('my_custom_curr');
var my_custom_curr_symbol2=decodeURIComponent(wprentals_getCookie('my_custom_curr_symbol2'));
var login_modal_type=1;
var scroll_trigger=0;
const longmonths=Array.from({length:12}, (_, m)=>
new Date(2019, m, 1).toLocaleString(control_vars.datepick_lang, {month:'long'})
);
const dayNamesShort_long=Array.from({length:7}, (_,d)=>
new Date(2019, 6, d).toLocaleString(control_vars.datepick_lang, {weekday:'short'})
);
const dayNamesShort=new Array();
dayNamesShort_long.forEach(wpestate_trim_daynames);
function wpestate_trim_daynames(value){
dayNamesShort.push(value.substring(0, 2));
}
function wprentals_getCookie(cname){
"use strict";
var name, ca, i, c;
name=cname + "=";
ca=document.cookie.split(';');
for (i=0; i < ca.length; i=i + 1){
c=ca[i];
while (c.charAt(0)===' ') c=c.substring(1);
if(c.indexOf(name)===0) return c.substring(name.length,c.length);
}
return "";
}
function wprentals_splash_slider(){
"use strict";
if(jQuery("#splash_slider_wrapper").length>0){
}}
(function($){
"use strict";
$.fn.nodoubletapzoom=function(){
$(this).bind('touchstart', function preventZoom(e){
var t2=e.timeStamp
, t1=$(this).data('lastTouch')||t2
, dt=t2 - t1
, fingers=e.originalEvent.touches.length;
$(this).data('lastTouch', t2);
if(!dt||dt > 500||fingers > 1) return;
e.preventDefault();
$(this).trigger('click').trigger('click');
});
};})(jQuery);
var widgetId1,widgetId2,widgetId3,widgetId4;
var wpestate_onloadCallback=function(){
"use strict";
if(document.getElementById('capthca_register')){
widgetId1=grecaptcha.render('capthca_register', {
'sitekey':control_vars.captchakey,
'theme':'light'
});
grecaptcha.reset();
}
if(document.getElementById('mobile_register_menu')){
widgetId2=grecaptcha.render('mobile_register_menu', {
'sitekey':control_vars.captchakey,
'theme':'light'
});
}
if(document.getElementById('widget_register_menu')){
widgetId3=grecaptcha.render('widget_register_menu', {
'sitekey':control_vars.captchakey,
'theme':'light'
});
}
if(document.getElementById('capthca_register_sh')){
widgetId4=grecaptcha.render('capthca_register_sh', {
'sitekey':control_vars.captchakey,
'theme':'light'
});
}};
jQuery(window).scroll(function ($){
"use strict";
var scroll=jQuery(window).scrollTop();
if(control_vars.stiky_search==='yes'){
wpestate_adv_search_sticky(scroll);
}else{
wpestate_header_sticky(scroll);
}});
function wpestate_header_sticky(scroll){
"use strict";
if(scroll >=10){
if(!Modernizr.mq('only all and (max-width: 1025px)')){
jQuery('.logo').addClass('miclogo');
if(!jQuery(".header_wrapper").hasClass('is_half_map')){
jQuery(".header_wrapper").addClass("navbar-fixed-top");
jQuery(".master_header").addClass("navbar-fixed-top-master");
jQuery(".header_wrapper").addClass("customnav");
if(jQuery(".header_wrapper").hasClass('transparent_header')){
has_transparent=1;
jQuery(".header_wrapper").removeClass('transparent_header');
if(control_vars.transparent_logo!==''){
if(control_vars.normal_logo!==''){
jQuery(".logo img").attr('src',control_vars.normal_logo);
}else{
jQuery(".logo img").attr('src',control_vars.path+"/img/logo.png");
}}
}}
jQuery('.barlogo').show();
jQuery('#user_menu_open').hide();
jQuery('#wpestate_header_shoping_cart').hide();
}
jQuery('.backtop').addClass('islive');
}else{
jQuery(".header_wrapper").removeClass("navbar-fixed-top");
jQuery(".master_header").removeClass("navbar-fixed-top-master");
jQuery(".header_wrapper").removeClass("customnav");
if(has_transparent===1){
jQuery(".header_wrapper").addClass('transparent_header');
if(control_vars.transparent_logo!==''){
jQuery(".logo img").attr('src',control_vars.transparent_logo);
}}
jQuery('.backtop').removeClass('islive');
jQuery('.contactformwrapper').addClass('hidden');
jQuery('.barlogo').hide();
jQuery('#user_menu_open').hide();
jQuery('#wpestate_header_shoping_cart').hide();
jQuery('.logo').removeClass('miclogo');
}}
function wpestate_adv_search_sticky(scroll){
"use strict";
if(scroll>20){
if(jQuery('.has_header_type4').length <=0){
jQuery(".master_header").hide();
}else{
jQuery('.top_bar_wrapper').hide();
}}else{
jQuery(".master_header,.top_bar_wrapper").show();
}
if(wpestate_isScrolledIntoView(scroll)&&scroll_trigger===0){
console.log('wpestate_isScrolledIntoView');
}
if(scroll_trigger!==0){
if(scroll < scroll_trigger){
jQuery('#search_wrapper').removeClass('sticky_adv').removeClass('sticky_adv_anime');
}else if(scroll > scroll_trigger-40&&scroll < scroll_trigger+100){
jQuery('#search_wrapper').addClass('sticky_adv_anime');
}else if(scroll > scroll_trigger){
jQuery('#search_wrapper').removeClass('sticky_adv_anime');
jQuery('#search_wrapper').addClass('sticky_adv');
}}
}
function wpestate_isScrolledIntoView(scroll){
"use strict";
if(jQuery('#search_wrapper').length>0){
var elemTop=parseInt(jQuery('#search_wrapper').offset().top);
var elemHeight=parseInt(jQuery('#search_wrapper').height());
elemHeight=0;
if((elemTop+elemHeight+3)
=110){
jQuery('#advanced_search_map_list_hidden').show();
jQuery('#advanced_search_map_list').removeClass('move_to_fixed');
}else{
jQuery('#advanced_search_map_list_hidden').hide();
}});
jQuery(window).resize(function (){
"use strict";
jQuery('#mobile_menu').hide('10');
});
Number.prototype.format=function (n, x){
"use strict";
var re;
re='\\d(?=(\\d{' + (x||3) + '})+' + (n > 0 ? '\\.':'$') + ')';
return this.toFixed(Math.max(0, ~~n)).replace(new RegExp(re, 'g'), '$&,');
};
function wpestate_show_capture_vertical(){
"use strict";
var position, slideno, slidedif, tomove, curentleft, position;
jQuery('#googleMapSlider').hide();
position=parseFloat(jQuery('#carousel-listing .carousel-inner .active').index(),10);
jQuery('#carousel-indicators-vertical li').removeClass('active');
jQuery('#carousel-listing .caption-wrapper span').removeClass('active');
jQuery("#carousel-listing .caption-wrapper span[data-slide-to='"+position+"'] ").addClass('active');
jQuery("#carousel-listing .caption-wrapper span[data-slide-to='"+position+"'] ").addClass('active');
jQuery("#carousel-indicators-vertical li[data-slide-to='"+position+"'] ").addClass('active');
slideno=position+1;
slidedif=slideno*92;
if(slidedif > 338){
tomove=338-slidedif;
tomove=tomove;
jQuery('#carousel-indicators-vertical').css('top',tomove+"px");
}else{
position=jQuery('#carousel-indicators-vertical').css('top',tomove+"px").position();
curentleft=position.top;
if(curentleft < 0){
tomove=0;
jQuery('#carousel-indicators-vertical').css('top',tomove+"px");
}}
}
function wpestate_owner_insert_book(){
"use strict";
var extra_options,fromdate, todate, listing_edit, nonce, ajaxurl, comment, booking_guest_no,action_function,to_be_paid,price;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
fromdate=jQuery("#start_date").val();
todate=jQuery("#end_date").val();
listing_edit=jQuery('#listing_edit').val();
comment=jQuery("#book_notes").val();
booking_guest_no=jQuery('#booking_guest_no_wrapper').attr('data-value');
extra_options='';
jQuery('.cost_row_extra input').each(function(){
if((jQuery(this).is(":checked"))){
if(!isNaN(jQuery(this).attr('data-key'))&&typeof(jQuery(this).attr('data-key'))!=undefined){
extra_options=extra_options+jQuery(this).attr('data-key')+",";
}}
});
action_function='wpestate_ajax_add_booking';
if(document.getElementById('submit_booking_front_instant')){
action_function='wpestate_ajax_add_booking_instant';
}
var nonce=jQuery('#wprentals_add_booking').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':action_function,
'fromdate':fromdate,
'todate':todate,
'listing_edit':listing_edit,
'comment':comment,
'booking_guest_no':booking_guest_no,
'extra_options':extra_options,
'security':nonce
},
success: function (data){
jQuery('.has_future').each(function (){
jQuery('#start_date, #end_date').val('');
jQuery('#booking_guest_no_wrapper').html(control_vars.guest_any+' ');
});
if(action_function=='wpestate_ajax_add_booking_instant'){
if(document.getElementById('submit_booking_front_instant')){
if(property_vars.logged_in==="no"){
window.location.href=data;
}else{
jQuery('#instant_booking_modal .modal-body').html(data);
jQuery('#instant_booking_modal').modal({
backdrop: 'static',
keyboard: false});
wpestate_create_payment_action();
}}
}else{
jQuery('#booking_form_request_mess').empty().removeClass('book_not_available').text(control_vars.bookconfirmed);
}
wpestate_redo_listing_sidebar();
},
error: function (errorThrown){
}});
}
function wpestate_redo_listing_sidebar(){
if(jQuery('#primary').hasClass('listing_type_1')){
return;
}
var newmargin=0;
var current_height=jQuery('#booking_form_request').outerHeight();
if(current_height > 525){
newmargin=current_height-525 + 180 ;
jQuery('#primary').css('margin-top',newmargin+'px');
}}
function wprentals_check_booking_valability(){
"use strict";
var book_from, book_to, listing_edit, ajaxurl,internal;
internal=0;
book_from=jQuery('#start_date').val();
book_to=jQuery('#end_date').val();
listing_edit=jQuery('#listing_edit').val();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
var nonce=jQuery('#wprentals_add_booking').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_check_booking_valability',
'book_from':book_from,
'book_to':book_to,
'listing_id':listing_edit,
'internal':internal,
'security':nonce
},
success: function (data){
if(data.trim()==='run'){
wpestate_owner_insert_book();
}else if(data==='stopcheckinout'){
jQuery('#booking_form_request_mess').empty().addClass('book_not_available').text(control_vars.stopcheckinout);
}else if(data==='stopcheckin'){
jQuery('#booking_form_request_mess').empty().addClass('book_not_available').text(control_vars.stopcheckin);
}else if(data==='stopdays'){
jQuery('#booking_form_request_mess').empty().addClass('book_not_available').text(control_vars.mindays);
}else{
jQuery('#booking_form_request_mess').empty().addClass('book_not_available').text(control_vars.bookdenied);
}},
error: function (errorThrown){
}});
}
function wpestate_show_instant_book_modal(){
}
function wpestate_owner_insert_book_internal(){
"use strict";
var fromdate, todate, listing_edit, nonce, ajaxurl, comment, booking_guest_no,hour_from,hour_to;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
fromdate=jQuery("#start_date_owner_book").val();
todate=jQuery("#end_date_owner_book").val();
listing_edit=jQuery('#listing_edit').val();
comment=jQuery("#book_notes").val();
booking_guest_no=jQuery('#booking_guest_no_wrapper').attr('data-value');
var nonce=jQuery('#wprentals_add_booking').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_add_booking',
'fromdate':fromdate,
'todate':todate,
'listing_edit':listing_edit,
'comment':comment,
'booking_guest_no':booking_guest_no,
'confirmed':1,
'security':nonce
},
success: function (data){
jQuery('.has_future').each(function (){
jQuery(this).removeClass('calendar-reserved-stop');
jQuery(this).removeClass('calendar-reserved-start');
jQuery(this).removeClass('calendar-reserved-stop-visual');
jQuery(this).removeClass('calendar-reserved-start-visual');
jQuery('#owner_reservation_modal').modal('hide');
jQuery('.booking-calendar-wrapper-in .calendar-selected').removeClass('calendar-selected');
jQuery('#book_dates').empty().text(ajaxcalls_vars.reserve);
jQuery('#book_notes').val('');
});
jQuery('#booking_form_request_mess').empty().text(control_vars.bookconfirmed);
},
error: function (errorThrown){
}});
}
function wpestate_check_booking_valability_internal(){
"use strict";
var book_from, book_to, listing_edit, ajaxurl,internal,hour_from,hour_to;
jQuery('#book_dates').empty().text(ajaxcalls_vars.saving);
book_from=jQuery('#start_date_owner_book').val();
book_to=jQuery('#end_date_owner_book').val();
var nonce=jQuery('#wprentals_add_booking').val();
listing_edit=jQuery('#listing_edit').val();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
internal=1;
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_check_booking_valability_internal',
'book_from':book_from,
'book_to':book_to,
'listing_id':listing_edit,
'internal':internal,
'security':nonce,
},
success: function (data){
if(data.trim()==='run'){
wpestate_owner_insert_book_internal();
}else{
jQuery('#book_dates').empty().text(ajaxcalls_vars.reserve);
}},
error: function (errorThrown){
}});
}
componentForm={
establishment: 'long_name',
street_number: 'short_name',
route: 'long_name',
locality: 'long_name',
administrative_area_level_1: 'long_name',
administrative_area_level_2: 'long_name',
country: 'long_name',
postal_code: 'short_name',
postal_code_prefix: 'short_name',
neighborhood: 'long_name',
natural_feature:'long_name'
};
function wpestate_convert_selected_days_reverse(date){
var from,return_date;
if(control_vars.date_format==='yy-mm-dd'){
return date;
}else if(control_vars.date_format==='yy-dd-mm'){
from=date.split("-");
return_date=from[0]+'-'+from[2]+'-'+from[1];
return return_date;
}else if(control_vars.date_format==='dd-mm-yy'){
from=date.split("-");
return_date=from[2]+'-'+from[1]+'-'+from[0];
return return_date;
}else if(control_vars.date_format==='mm-dd-yy'){
from=date.split("-");
return_date=from[1]+'-'+from[2]+'-'+from[0];
return return_date;
}else if(control_vars.date_format==='dd-yy-mm'){
from=date.split("-");
return_date=from[2]+'-'+from[0]+'-'+from[1];
return return_date;
}else if(control_vars.date_format==='mm-yy-dd'){
from=date.split("-");
return_date=from[1]+'-'+from[0]+'-'+from[2];
return return_date;
}}
function wpestate_convert_selected_days(date){
var from,return_date,date_format;
if(property_vars.book_type==='2'){
date_format=control_vars.date_format.toUpperCase()+" HH:mm";
}else{
date_format=control_vars.date_format.toUpperCase();
}
var new_date_format=date_format.replace("YY", "YYYY");
if(property_vars.book_type==='2'){
var return_date=moment(date,new_date_format).format('YYYY-MM-DD HH:mm');
}else{
var return_date=moment(date,new_date_format).format('YYYY-MM-DD');
}
return return_date;
}
function wpestate_convert_selected_days_simple_add_days(date,days){
var date_format=control_vars.date_format.toUpperCase();
var new_date_format=date_format.replace("YY", "YYYY");
var return_date=moment(date,new_date_format).add(days, 'days');
return_date=moment(return_date).format(new_date_format);
return return_date;
}
function wpestate_convert_selected_days_simple(date){
var from,return_date;
var date_format=control_vars.date_format.toUpperCase();
var new_date_format=date_format.replace("YY", "YYYY");
var return_date=moment(date,new_date_format).format('DD-MM-YYYY');
return return_date;
}
function wpestate_UTC_addDays(date, days){
var result=new Date(date);
var now_utc=new Date(result.getUTCFullYear(), result.getUTCMonth(), result.getUTCDate(), result.getUTCHours(), result.getUTCMinutes(), result.getUTCSeconds());
var new_day=parseFloat(result.getUTCDate())+1 + parseFloat(days);
now_utc.setDate(new_day);
return now_utc;
}
function wpestaste_check_in_out_enable(in_date, out_date){
"use strict";
wpestaste_check_in_out_enable_new(in_date, out_date);
return;
}
function wpestaste_check_in_out_enable_new(in_date, out_date){
var today, prev_date,read_in_date;
today=new Date();
var date_format=control_vars.date_format.toUpperCase();
today=moment(today).format("MM/DD/YYYY");
jQuery("#" + in_date).attr('readonly','readonly');
var options={
singleDatePicker: false,
autoApply: true,
alwaysShowCalendars: true,
autoUpdateInput: false,
minDate:today,
locale:{
daysOfWeek:dayNamesShort,
monthNames:longmonths
},
isCustomDate:'isCustomDate_wpstate'
};
if(in_date==='booking_from_date'){
options.parentEl="#contact_owner_modal";
}
var date_format=control_vars.date_format.toUpperCase();
date_format=date_format.replace("YY", "YYYY");
var in_date_front=jQuery('#' + in_date);
var out_date_front=jQuery('#' + out_date);
jQuery("#" + in_date).daterangepicker(options,
function (start, end, label){
jQuery("#" + out_date).removeAttr('disabled');
start_date=start.format(date_format);
end_date=end.format(date_format);
in_date_front.val(start_date);
out_date_front.val(end_date);
if(jQuery("#google_map_prop_list_sidebar").length>0){
wpestate_start_filtering_ajax_map(1);
}}
);
}
function isCustomDate_wpstate(date){
return 'maca';
}
function wpestate_booking_calendat_get_price(unixtime1_key,display_price){
var return_price;
return_price='';
if(!isNaN(my_custom_curr_pos)&&my_custom_curr_pos!==-1){
if(my_custom_curr_cur_post==='before'){
if(price_array[unixtime1_key]===undefined){
if(display_price===''){
display_price=control_vars.default_price;
}
if(parseFloat(price_per_guest_from_one,10)===1){
display_price=parseFloat (extra_price_per_guest,10);
}
display_price=wpestate_replace_plus(decodeURIComponent(my_custom_curr_label)) + String(Math.round(display_price* my_custom_curr_coef));
}else{
if(display_price===''){
display_price=price_array[unixtime1_key] ;
}
if(parseFloat(price_per_guest_from_one,10)===1){
display_price=mega_details[unixtime1_key]['period_extra_price_per_guest'];
}
display_price=wpestate_replace_plus(decodeURIComponent(my_custom_curr_label)) + String(Math.round(display_price * my_custom_curr_coef));
}}else{
if(price_array[unixtime1_key]===undefined){
if(display_price===''){
display_price=control_vars.default_price;
}
if(parseFloat(price_per_guest_from_one,10)===1){
display_price=parseFloat (extra_price_per_guest,10);
}
display_price=String(Math.round(display_price * my_custom_curr_coef)) + wpestate_replace_plus(decodeURIComponent(my_custom_curr_label)) ;
}else{
if(display_price===''){
display_price=price_array[unixtime1_key] ;
}
if(parseFloat(price_per_guest_from_one,10)===1){
display_price=mega_details[unixtime1_key]['period_extra_price_per_guest'];
}
display_price=String(Math.round(display_price * my_custom_curr_coef))+ wpestate_replace_plus(decodeURIComponent(my_custom_curr_label));
}}
}else{
if(control_vars.where_curency==='before'){
if(price_array[unixtime1_key]===undefined){
if(display_price===''){
display_price=control_vars.default_price;
}
display_price=wpestate_replace_plus(decodeURIComponent(control_vars.curency)) + display_price;
}else{
if(display_price===''){
display_price=price_array[unixtime1_key] ;
}
display_price=wpestate_replace_plus(decodeURIComponent(control_vars.curency)) + String(display_price);
}}else{
if(price_array[unixtime1_key]===undefined){
if(display_price===''){
display_price=control_vars.default_price;
}
display_price=display_price + wpestate_replace_plus(decodeURIComponent(control_vars.curency));
}else{
if(display_price===''){
display_price=price_array[unixtime1_key] ;
}
display_price=String(display_price)+ wpestate_replace_plus(decodeURIComponent(control_vars.curency));
}}
}
if(parseFloat(price_per_guest_from_one,10)===1){
if(!isNaN(my_custom_curr_pos)&&my_custom_curr_pos!==-1){
var to_show=parseFloat (extra_price_per_guest,10)*my_custom_curr_coef;
if(my_custom_curr_cur_post==='before'){
display_price=control_vars.from+" "+wpestate_replace_plus(decodeURIComponent(my_custom_curr_label))+ ' '+ to_show.toFixed(0) ;
}else{
display_price=control_vars.from+" "+ to_show.toFixed(0) + wpestate_replace_plus(decodeURIComponent(my_custom_curr_label)) ;
}}else{
if(control_vars.where_curency==='before'){
display_price=control_vars.from+" "+wpestate_replace_plus(decodeURIComponent(control_vars.curency))+parseFloat (extra_price_per_guest,10) ;
}else{
display_price=control_vars.from+" "+parseFloat (extra_price_per_guest,10) + wpestate_replace_plus(decodeURIComponent(control_vars.curency)) ;
}}
}
return display_price;
}
function wpestate_enable_slider_radius(slider_name,low_val, max_val, now_val){
if(jQuery("#" + slider_name).length > 0){
jQuery("#" + slider_name).slider({
range: true,
min: parseFloat(low_val),
max: parseFloat(max_val),
value: parseFloat(now_val),
range: "max",
slide: function (event, ui){
jQuery("#geolocation_radius").val(ui.value);
jQuery('.radius_value').text(ui.value+" "+control_vars.geo_radius_measure);
},
stop: function (event, ui){
if(placeCircle!=''){
if(control_vars.geo_radius_measure==='miles'){
placeCircle.setRadius(ui.value*1609.34);
}else{
placeCircle.setRadius(ui.value*1000);
}
map.fitBounds(placeCircle.getBounds());
wpestate_start_filtering_ajax_map(1);
}}
});
}
jQuery("#geolocation_search").on('change', function(){
if(jQuery(this).val()===''){
jQuery('#geolocation_lat').val('');
jQuery('#geolocation_long').val('');
if(placeCircle!=''){
placeCircle.setMap(null);
placeCircle='';
}}
});
if(jQuery("#geolocation_search").length > 0){
if(typeof google==='object'&&typeof google.maps==='object'&&parseInt(mapbase_vars.wprentals_places_type)==1){
var input, defaultBounds, autocomplete_normal;
input=(document.getElementById('geolocation_search'));
defaultBounds=new google.maps.LatLngBounds(new google.maps.LatLng(-90, -180),
new google.maps.LatLng(90, 180)
);
var options={
bounds: defaultBounds,
types: ['geocode'],
};
autocomplete_normal=new google.maps.places.Autocomplete(input, options);
google.maps.event.addListener(autocomplete_normal, 'place_changed', function (){
initial_geolocation_circle_flag=0;
var place=autocomplete_normal.getPlace();
var place_lat=place.geometry.location.lat();
var place_lng=place.geometry.location.lng();
jQuery('#geolocation_lat').val(place_lat);
jQuery('#geolocation_long').val(place_lng);
wpestate_start_filtering_ajax_map(1);
});
}}
}
function wpestate_enable_slider(slider_name, price_low, price_max, amount, my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post, my_custom_curr_coef,my_custom_curr_label){
"use strict";
var price_low_val, price_max_val, temp_min, temp_max;
price_low_val=parseFloat(jQuery('#'+price_low).val(), 10);
price_max_val=parseFloat(jQuery('#'+price_max).val(), 10);
var slider_min=control_vars.slider_min;
var slider_max=control_vars.slider_max;
if(!isNaN(my_custom_curr_pos)&&my_custom_curr_pos!==-1){
slider_min=parseFloat(slider_min *my_custom_curr_coef,10);
slider_max=parseFloat(slider_max *my_custom_curr_coef,10);
}
jQuery("#" + slider_name).slider({
range: true,
min: parseFloat(slider_min),
max: parseFloat(slider_max),
values: [price_low_val, price_max_val ],
slide: function (event, ui){
jQuery("#" + price_low).val(ui.values[0]);
jQuery("#" + price_max).val(ui.values[1]);
if(!isNaN(my_custom_curr_pos)&&my_custom_curr_pos!==-1){
temp_min=ui.values[0];
temp_max=ui.values[1];
if(my_custom_curr_cur_post==='before'){
jQuery("#" + amount).text(wpestate_replace_plus(decodeURIComponent(my_custom_curr_label)) + " " + temp_min.format() + " " + control_vars.to + " " + wpestate_replace_plus(decodeURIComponent(my_custom_curr_label))+ " " + temp_max.format());
}else{
jQuery("#" + amount).text(temp_min.format() + " " + wpestate_replace_plus(decodeURIComponent(my_custom_curr_label))+ " " + control_vars.to + " " + temp_max.format() + " " + wpestate_replace_plus(decodeURIComponent(my_custom_curr_label)));
}}else{
if(control_vars.where_curency==='before'){
jQuery("#" + amount).text(wpestate_replace_plus(decodeURIComponent(control_vars.curency)) + " " + ui.values[0].format() + " " + control_vars.to + " " + wpestate_replace_plus(decodeURIComponent(control_vars.curency)) + " " + ui.values[1].format());
}else{
jQuery("#" + amount).text(ui.values[0].format() + " " + wpestate_replace_plus(decodeURIComponent(control_vars.curency)) + " " + control_vars.to + " " + ui.values[1].format() + " " + wpestate_replace_plus(decodeURIComponent(control_vars.curency)));
}}
}});
}
function wpestate_replace_plus(string){
return string.replace("+"," ");
}
function wpestate_prevent_enter_submit(main_search,search_location, check_in, check_out, guest_no){
jQuery('#'+main_search).on("keyup keypress", function(e){
var code=e.keyCode||e.which;
if(code==13){
e.preventDefault();
if(jQuery('#'+search_location).val()!==''){
if(jQuery('#'+check_in).val()!==''){
if(jQuery('#'+check_out).val()!==''){
jQuery('#'+check_out).focusout();
jQuery('#'+check_out).datepicker("hide");
jQuery('#'+guest_no).focus().dropdown('toggle');
jQuery('#'+check_out).datepicker("hide");
}else{
jQuery('#'+check_in).datepicker("hide");
jQuery('#'+check_out).datepicker("show");
}}else{
jQuery('#'+check_in).datepicker("show");
}}
return false;
}});
}
function wpestate_lazy_load_carousel_property_unit(){
jQuery('.property_unit_carousel img').each(function(event){
var new_source='';
new_source=jQuery(this).attr('data-lazy-load-src');
if(typeof (new_source)!=='undefined'&&new_source!==''){
jQuery(this).attr('src',new_source);
}});
}
jQuery(document).ready(function ($){
"use strict";
var bLazy, search_label, curent, price_regular, price_featured, total, percent, parent, price_low_val, price_max_val, autoscroll_slider, all_browsers_stuff, wrap_h, map_h, mediaQuery;
$.datepicker.setDefaults($.datepicker.regional[control_vars.datepick_lang]);
$.datepicker.setDefaults({
dateFormat: control_vars.date_format,
});
if(control_vars.wp_estate_slider_cycle!=''&&control_vars.wp_estate_slider_cycle!='0'){
$('#estate-carousel_slick').slick({
'arrows':true,
'dots':true,
'cssEase': 'cubic-bezier(0.645, 0.045, 0.355, 1.000)',
'autoplay': true,
'autoplaySpeed': control_vars.wp_estate_slider_cycle
});
}else{
$('#estate-carousel_slick').slick({
'arrows':true,
'dots':true,
'cssEase': 'cubic-bezier(0.645, 0.045, 0.355, 1.000)',
});
}
$('#listing_main_image_photo_slider').slick({
infinite: true,
slidesToShow: 3,
slidesToScroll: 1,
dots: true,
'arrows':true,
responsive: [
{
breakpoint:1025,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}}
]
});
if(control_vars.is_rtl==='1'){
$('#listing_main_image_photo_slider').slick('slickSetOption','rtl',true,true);
}
if(Modernizr.mq('only all and (min-width: 1024px)')){
$('#estate-carousel_slick').on('beforeChange', function(event, slick, currentSlide, nextSlide){
$('.item-version').hide(200);
$('.price-slider-wrapper').hide(300);
$('.theme-slider-view').hide(400);
});
$('#estate-carousel_slick').on('afterChange', function(event, slick, currentSlide, nextSlide){
$('.item-version').slideDown('200',function(){
$('.price-slider-wrapper').slideDown(300);
$('.theme-slider-view').slideDown(600);
});
});
}
if($(".full_screen_yes").length){
var new_height;
if(jQuery('.transparent_header').length > 0){
new_height=jQuery(window).height();
}else{
new_height=jQuery(window).height() - jQuery('.master_header').height();
}
if($('.with_search_on_start').length>0){
new_height=new_height- jQuery('.search_wrapper.with_search_on_start ').height();
}
jQuery('.wpestate_header_image,.wpestate_header_video,.theme_slider_wrapper,.theme_slider_classic,.theme_slider_wrapper .item_type2 ').css('height',new_height);
}
$('.search_location_autointernal_list li').on('click',function(event){
var meta_tax=$(this).attr('data-tax');
var parent=$(this).parent().parent().parent();
parent.find('.stype').val(meta_tax);
});
var handler_top;
$('.adv_handler').on('click', function(event){
event.preventDefault();
var check_row=$('.adv_search_hidden_fields');
if($('#search_wrapper').hasClass('with_search_form_float')){
if(!$('#search_wrapper').hasClass('openmore')){
check_row.css('display','block');
var height=check_row.height();
handler_top=parseInt($('#search_wrapper').css('top'));
var top=parseInt($('#search_wrapper').css('top'))-height;
check_row.css('display','none');
$('.adv_search_hidden_fields').slideDown({ duration: 200, queue: false });
$('#search_wrapper').addClass('openmore');
}else{
$('.adv_search_hidden_fields').slideUp ({ duration: 200, queue: false });
$('#search_wrapper').removeClass('openmore');
}}else{
$('.adv_search_hidden_fields').slideToggle();
}});
$('.estate_places_slider').each(function(){
var items=$(this).attr('data-items-per-row');
var auto=parseInt($(this).attr('data-auto'));
var slick=$(this).slick({
infinite: true,
slidesToShow: items,
slidesToScroll: 1,
dots: false,
responsive: [
{
breakpoint:1025,
settings: {
slidesToShow: 2,
slidesToScroll: 1
}},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
slidesToScroll: 1
}}
]
});
if(control_vars.is_rtl==='1'){
$(this).slick('slickSetOption','rtl',true,true);
$(this).slick('slidesToScroll','-1');
}});
wpestate_enable_stripe_booking_prop();
jQuery('#direct_pay').on('click',function(){
var direct_pay_modal, selected_pack,selected_prop,include_feat,attr, price_pack;
selected_pack=$('#pack_select').val();
var price_pack=$('#pack_select option:selected').attr('data-price');
if(control_vars.where_curency==='after'){
price_pack=price_pack +' '+control_vars.submission_curency;
}else{
price_pack=control_vars.submission_curency+' '+price_pack;
}
price_pack=control_vars.direct_price+': '+price_pack;
if(selected_pack!==''){
window.scrollTo(0, 0);
direct_pay_modal=''+price_pack+' '+control_vars.direct_pay+' '+control_vars.send_invoice+'
';
jQuery('body').append(direct_pay_modal);
jQuery('#direct_pay_modal').modal();
wpestate_enable_direct_pay();
}
$('#direct_pay_modal').on('hidden.bs.modal', function (e){
$('#direct_pay_modal').remove();
});
});
$('.perpack').on('click',function(){
var direct_pay_modal, selected_pack,selected_prop,include_feat,attr;
selected_prop=$(this).attr('data-listing');
var price_pack=$(this).parent().parent().find('.submit-price-total').text();
attr=$(this).attr('data-isupgrade');
if(typeof attr!==typeof undefined&&attr!==false){
price_pack=$(this).parent().parent().find('.submit-price-featured').text();
}
if(control_vars.where_curency==='after'){
price_pack=price_pack +' '+control_vars.submission_curency;
}else{
price_pack=control_vars.submission_curency+' '+price_pack;
}
price_pack=control_vars.direct_price+': '+price_pack;
include_feat=' data-include-feat="0" ';
$('#send_direct_bill').attr('data-include-feat',0);
$('#send_direct_bill').attr('data-listing',selected_prop);
if($(this).parent().find('.extra_featured').attr('checked')){
include_feat=' data-include-feat="1" ';
$('#send_direct_bill').attr('data-include-feat',1);
}
if(typeof attr!==typeof undefined&&attr!==false){
include_feat=' data-include-feat="1" ';
$('#send_direct_bill').attr('data-include-feat',1);
}
window.scrollTo(0, 0);
direct_pay_modal='
'+price_pack+' '+control_vars.direct_pay+' '+control_vars.send_invoice+'
';
jQuery('body').append(direct_pay_modal);
jQuery('#direct_pay_modal').modal();
wpestate_enable_direct_pay_perlisting();
$('#direct_pay_modal').on('hidden.bs.modal', function (e){
$('#direct_pay_modal').remove();
});
});
function wpestate_enable_direct_pay(){
jQuery('#send_direct_bill').on('click',function(){
jQuery('#send_direct_bill').unbind('click');
var selected_pack,ajaxurl;
selected_pack=jQuery(this).attr('data-pack');
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
var nonce=jQuery('#wprentals_payments_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_direct_pay_pack',
'selected_pack':selected_pack,
'security':nonce,
},
success: function (data){
jQuery('#send_direct_bill').hide();
jQuery('#direct_pay_modal .listing-submit span:nth-child(2)').empty().html(control_vars.direct_thx);
},
error: function (errorThrown){}});
});
}
function wpestate_enable_direct_pay_perlisting(){
jQuery('#send_direct_bill').unbind('click');
jQuery('#send_direct_bill').on('click',function(){
jQuery('#send_direct_bill').unbind('click');
var selected_pack,ajaxurl,include_feat;
selected_pack=jQuery(this).attr('data-listing');
include_feat=jQuery(this).attr('data-include-feat');
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
var nonce=jQuery('#wprentals_payments_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_direct_pay_pack_per_listing',
'selected_pack':selected_pack,
'include_feat':include_feat,
'security':nonce
},
success: function (data){
jQuery('#send_direct_bill').hide();
jQuery('#direct_pay_modal .listing-submit span:nth-child(2)').empty().html(control_vars.direct_thx);
},
error: function (errorThrown){}});
});
}
if(document.getElementById('imagelist')){
$("#imagelist").sortable({
revert: true,
update: function(event, ui){
var all_id,new_id;
all_id="";
$("#imagelist .uploaded_images").each(function(){
new_id=$(this).attr('data-imageid');
if(typeof new_id!='undefined'){
all_id=all_id+","+new_id;
}});
$('#attachid').val(all_id);
},
});
}
$(window).bind("load", function(){
wpestate_lazy_load_carousel_property_unit();
});
$('.retina_ready').dense();
$('#user_tab_menu_trigger').on('click',function(){
$('#user_tab_menu_container').toggle('200');
});
$('#carousel-listing').on('slid.bs.carousel', function (){
wpestate_show_capture_vertical();
$('#carousel-listing div').removeClass('slideron');
$('#slider_enable_slider').addClass('slideron');
});
wpestate_prevent_enter_submit('main_search','search_location','check_in','check_out','guest_no');
wpestate_prevent_enter_submit('widget_search','search_locationsidebar','checkinwidget','checkoutwidget','guest_no_wid');
wpestate_prevent_enter_submit('form-search-mobile','search_location_mobile','check_in_mobile','check_out_mobile','guest_no_mobile');
jQuery('.blog_unit_back ').on('click',function(){
window.open($(this).find('.blog-title-link').attr('href'), '_self', false);
});
jQuery(".calendar_pad").on("hover", function(event){
if(event.type==="mouseenter"){
var timeunix=$(this).attr('data-curent-date');
$(".calendar_pad[data-curent-date=" + timeunix + "]").addClass('calendar-pad-hover');
$(".calendar_pad_title[data-curent-date=" + timeunix + "]").addClass('calendar-pad-hover');
if($(this).hasClass('calendar-reserved')){
var reservation_data=$(this).find('.allinone_reservation');
reservation_data.show();
var internal_booking_id=parseFloat($(this).find('.allinone_reservation').attr('data-internal-reservation'),10);
if(!isNaN(internal_booking_id)&&internal_booking_id!=0){
var ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
var nonce=jQuery('#wprentals_allinone').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_get_booking_data',
'internal_booking_id':internal_booking_id,
'security':nonce
},
success: function (data){
reservation_data.empty().append(data);
},
error: function (errorThrown){}});
}}
}else if(event.type==="mouseleave"){
$(this).find('.allinone_reservation').hide();
var timeunix=$(this).attr('data-curent-date');
$(".calendar_pad[data-curent-date=" + timeunix + "]").removeClass('calendar-pad-hover');
$(".calendar_pad_title[data-curent-date=" + timeunix + "]").removeClass('calendar-pad-hover');
}});
$('.all-elements').animate({
minHeight: 100 + '%'
});
$('.header-tip').addClass('hide-header-tip');
$('.mobile-trigger').on('click',function (){
if($('#all_wrapper').hasClass('moved_mobile')){
$('.mobilewrapper-user').show();
$('#all_wrapper').removeAttr('style');
$('#all_wrapper').removeClass('moved_mobile');
$('.mobilewrapper').removeAttr('style');
}else{
$('.mobilewrapper-user').hide();
$('.mobilewrapper').show();
$('#all_wrapper').css('-webkit-transform', 'translate(265px, 0px)');
$('#all_wrapper').css('-moz-transform', 'translate(265px, 0px)');
$('#all_wrapper').css('-ms-transform', 'translate(265px, 0px)');
$('#all_wrapper').css('-o-transform', 'translate(265px, 0px)');
$('#all_wrapper').addClass('moved_mobile');
$('.mobilewrapper').css('-webkit-transform', 'translate(0px, 0px)');
$('.mobilewrapper').css('-moz-transform', 'translate(0px, 0px)');
$('.mobilewrapper').css('-ms-transform', 'translate(0px, 0px)');
$('.mobilewrapper').css(' -o-transform', 'translate(0px, 0px)');
}});
$('.mobile-trigger-user').on('click',function (){
if($('#all_wrapper').hasClass('moved_mobile_user')){
$('#all_wrapper').removeClass('moved_mobile_user');
$('#all_wrapper').removeAttr('style');
$('.mobilewrapper-user').hide();
$('.mobilewrapper').show();
$('.mobilewrapper-user').removeAttr('style');
}else{
$('#all_wrapper').css('-webkit-transform', 'translate(-265px, 0px)');
$('#all_wrapper').css('-moz-transform', 'translate(-265px, 0px)');
$('#all_wrapper').css('-ms-transform', 'translate(-265px, 0px)');
$('#all_wrapper').css('-o-transform', 'translate(-265px, 0px)');
$('#all_wrapper').addClass('moved_mobile_user');
$('.mobilewrapper-user').show();
$('.mobilewrapper').hide();
$('.mobilewrapper-user').css('-webkit-transform', 'translate(0px, 0px)');
$('.mobilewrapper-user').css('-moz-transform', 'translate(0px, 0px)');
$('.mobilewrapper-user').css('-ms-transform', 'translate(0px, 0px)');
$('.mobilewrapper-user').css(' -o-transform', 'translate(0px, 0px)');
}});
$('.user_tab_menu_close').on('click',function (){
$('#all_wrapper').removeAttr('style');
$('#all_wrapper').removeClass('moved_mobile_user');
$('#user_tab_menu_container').removeAttr('style');
});
$('.mobilemenu-close-user').on('click',function (){
$('#all_wrapper').removeAttr('style');
$('#all_wrapper').removeClass('moved_mobile_user');
$('.mobilewrapper-user').removeAttr('style');
});
$('.mobilemenu-close').on('click',function (){
$('.mobilewrapper-user').show();
$('#all_wrapper').removeAttr('style');
$('#all_wrapper').removeClass('moved_mobile');
$('.mobilewrapper').removeAttr('style');
});
$('.mobilex-menu li').on('click',function (event){
event.stopPropagation();
var selected;
selected=$(this).find('.sub-menu:first');
selected.slideToggle();
});
$('#user_menu_u').on('click',function (event){
jQuery('#wpestate_header_shoping_cart').fadeOut(400);
if($('#user_menu_open').is(":visible")){
$('#user_menu_open').removeClass('iosfixed').fadeOut(400);
}else{
$('#user_menu_open').fadeIn(400);
}
event.stopPropagation();
});
$('#shopping-cart').on('click',function (event){
$('#user_menu_open').removeClass('iosfixed').fadeOut(400);
if($('#wpestate_header_shoping_cart').is(":visible")){
jQuery('#wpestate_header_shoping_cart').fadeOut(400);
}else{
jQuery('#wpestate_header_shoping_cart').fadeIn(400);
}
event.stopPropagation();
});
$(document).on('click',function (event){
var clicka;
clicka=event.target.id;
jQuery('#wpestate_header_shoping_cart').fadeOut(400);
if(!$('#' + clicka).parents('.topmenux').length){
$('#user_menu_open').removeClass('iosfixed').hide(400);
}});
$('.list_sidebar_currency li').on('click',function (){
var ajaxurl, data, pos, symbol, coef, curpos,symbol2;
data=$(this).attr('data-value');
pos=$(this).attr('data-pos');
symbol=$(this).attr('data-symbol');
coef=$(this).attr('data-coef');
curpos=$(this).attr('data-curpos');
symbol2=$(this).attr('data-symbol2');
var nonce=jQuery('#wprentals_change_currency').val();
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_set_cookie_multiple_curr',
'curr':data,
'pos':pos,
'symbol':symbol,
'symbol2':symbol2,
'coef':coef,
'curpos':curpos,
'security':nonce,
},
success: function (data){
location.reload();
},
error: function (errorThrown){}});
});
$('#adv_extended_options_text_adv').on('click',function (){
$('#extended_search_check_filter,.extended_search_check_wrapper').slideDown();
$('#adv_extended_close_adv').show();
$(this).hide();
});
$('#adv_extended_close_adv').on('click',function (){
$(this).hide();
$('#extended_search_check_filter,.extended_search_check_wrapper').slideUp();
$('#adv_extended_options_text_adv').show();
});
$('#adv_extended_options_show_filters').on('click',function (){
$('#advanced_search_map_list').addClass('move_to_fixed');
$('#extended_search_check_filter').slideDown();
$('#adv_extended_close_adv').show();
$('#adv_extended_options_text_adv').hide();
});
wpestaste_check_in_out_enable('check_in', 'check_out');
wpestaste_check_in_out_enable('check_in_list', 'check_out_list');
wpestaste_check_in_out_enable('booking_from_date', 'booking_to_date');
wpestaste_check_in_out_enable('check_in_mobile', 'check_out_mobile');
wpestaste_check_in_out_enable('check_in_widget', 'check_out_widget');
wpestaste_check_in_out_enable('check_in_shortcode', 'check_out_shortcode');
$('#ui-datepicker-div').css('clip', 'auto');
$('#pack_select').change(function (){
if($(this).val()!==''){
$('.pay_disabled').removeClass('pay_disabled');
}else{
$('.payments_buttons_wrapper').addClass('pay_disabled');
}
var stripe_pack_id, stripe_ammount, the_pick,labelstripe;
$("#pack_select option:selected").each(function (){
stripe_pack_id=$(this).val();
stripe_ammount=parseFloat($(this).attr('data-price')) ;
the_pick=$(this).attr('data-pick');
labelstripe=$(this).text();
});
$('#pack_id').val(stripe_pack_id);
$('#pay_ammout').val(stripe_ammount);
$('.wpestate_stripe_pay_desc').html(control_vars.stripe_pay_for+" "+labelstripe);
$('#wpestate_stripe_form_button_sumit').html(control_vars.stripe_pay+" "+stripe_ammount+" "+control_vars.submission_curency);
});
$('#pack_recuring').on('click',function (){
if($(this).attr('checked')){
$('#stripe_form').append('
');
}else{
$('#stripe_recuring').remove();
}});
$('.check_avalability, .property_menu_wrapper_hidden a').on('click',function (){
var target;
if(location.pathname.replace(/^\//, '')===this.pathname.replace(/^\//, '')&&location.hostname===this.hostname){
target=$(this.hash);
if(target.selector==='#carousel-control-theme-next'||target.selector==='#carousel-control-theme-prev'||target.selector==='#carousel-listing'||target.selector==='#carousel-example-generic'||target.selector==='#post_carusel_right'){
return;
}
target=target.length ? target:$('[name=' + this.hash.slice(1) + ']');
if(target.length){
$('html,body').animate({
scrollTop: target.offset().top - 140
}, 1000);
return false;
}}
});
jQuery("#google_map_prop_list_sidebar .listing_wrapper").on("hover", function(event){
if(event.type==="mouseenter"){
event.stopPropagation();
var listing_id=$(this).attr('data-listid');
if(typeof wpestate_hover_action_pin=='function'){
wpestate_hover_action_pin(listing_id);
}}else if(event.type==="mouseleave"){
event.stopPropagation();
var listing_id=$(this).attr('data-listid');
if(typeof wpestate_return_hover_action_pin=='function'){
wpestate_return_hover_action_pin(listing_id);
}}
});
componentForm={
establishment: 'long_name',
street_number: 'short_name',
route: 'long_name',
locality: 'long_name',
administrative_area_level_1: 'long_name',
administrative_area_level_2: 'long_name',
administrative_area_level_3: 'long_name',
administrative_area_level_4: 'long_name',
country: 'long_name',
postal_code: 'short_name',
postal_code_prefix:'short_name',
neighborhood: 'long_name',
sublocality_level_1: 'long_name',
natural_feature:'long_name'
};
wpestate_autocomplete_google('search_location');
wpestate_autocomplete_google('search_locationshortcode');
wpestate_autocomplete_google('search_locationmobile');
wpestate_autocomplete_google('search_locationsidebar');
function wpestate_autocomplete_google(input_id){
if(typeof google==='object'&&typeof google.maps==='object'&&parseInt(mapbase_vars.wprentals_places_type)==1){
var input, defaultBounds, autocomplete_normal,extension;
input=(document.getElementById(input_id));
if(input instanceof HTMLInputElement){
extension='';
if(input_id=='search_locationshortcode'){
extension='shortcode';
}else if(input_id=='search_locationmobile'){
extension='mobile';
}else if(input_id=='search_locationsidebar'){
extension='sidebar';
}
defaultBounds=new google.maps.LatLngBounds(new google.maps.LatLng(-90, -180),
new google.maps.LatLng(90, 180)
);
var options={
bounds: defaultBounds,
types: ['geocode'],
};
autocomplete_normal=new google.maps.places.Autocomplete(input, options);
google.maps.event.addListener(autocomplete_normal, 'place_changed', function (){
var place=autocomplete_normal.getPlace();
wprentals_fillInAddress_filter_google(place,extension);
});
}}
}
function wprentals_fillInAddress_filter_google(place,extension){
var i, addressType, val, is_google_map,have_city,admin_area;
have_city=0;
admin_area='';
$('#advanced_area'+extension).val('');
$('#advanced_city'+extension).val('');
$('#advanced_country'+extension).val('');
$('#search_location_area'+extension).val('');
$('#search_location_city'+extension).val('');
$('#search_location_country'+extension).val('');
$('#property_admin_area'+extension).val('');
for (i=0; i < place.address_components.length; i++){
addressType=place.address_components[i].types[0];
val=place.address_components[i][componentForm[addressType]];
if(typeof (val)!=='undefined'){
val=val.toLowerCase();
val=val.split(' ').join('-');
}
if(addressType==='neighborhood'||addressType==='sublocality_level_1'){
$('#advanced_area'+extension).attr('data-value', val);
$('#advanced_area'+extension).val(val);
$('#search_location_area'+extension).val(val);
}else if(addressType==='administrative_area_level_4'){
admin_area=wpestate_build_admin_area(admin_area,val);
}else if(addressType==='administrative_area_level_3'){
admin_area=wpestate_build_admin_area(admin_area,val);
}else if(addressType==='administrative_area_level_2'){
admin_area=wpestate_build_admin_area(admin_area,val);
}else if(addressType==='administrative_area_level_1'){
admin_area=wpestate_build_admin_area(admin_area,val);
}else if(addressType==='locality'){
$('#advanced_city'+extension).attr('data-value', val);
$('#advanced_city'+extension).val(val);
$('#search_location_city'+extension).val(val);
if(val!==''){
have_city=1;
}}else if(addressType==='country'||addressType==='natural_feature'){
$('#advanced_country'+extension).attr('data-value', val);
$('#advanced_country'+extension).val(val);
$('#search_location_country'+extension).val(val);
}}
if(have_city===0){
wpestate_second_measure_city('advanced_city'+extension,place.adr_address);
wpestate_second_measure_city('search_location_city'+extension,place.adr_address);
}
if(jQuery('#advanced_search_map_list').length>0){
wpestate_start_filtering_ajax_map(1);
}
is_google_map=parseFloat(jQuery('#isgooglemap').attr('data-isgooglemap'), 10);
if(is_google_map===1){
var guest_val=$(this).attr('data-value');
}}
function wpestate_build_admin_area(admin_area,val){
if(admin_area===''){
admin_area=admin_area+val;
}else{
admin_area=admin_area+", "+val;
}
$('#property_admin_area,#property_admin_areasidebar,#property_admin_areashortcode,#property_admin_areamobile').val(admin_area);
return admin_area;
}
function wpestate_second_measure_city(stringplace,adr_address){
var new_city;
new_city=$(adr_address).filter('span.locality').html() ;
$('#'+stringplace).val(new_city);
}
function wpestate_fillInAddress(){
var place, adr, country;
place=autocomplete.getPlace();
adr=place['address_components'];
country=adr[adr.length - 1]['long_name'];
document.getElementById('property_city').value=place['name'];
document.getElementById('property_country').value=country;
}
$('#check_out').change(function(){
if($('#check_in').val()!==''){
var guest_val=$(this).attr('data-value');
}});
$('#guest_no_main_list li').on('click',function(){
var guest_val=$(this).attr('data-value');
});
$('#topbarlogin').on('click',function (event){
wpestate_show_login_form(1, 0, 0);
});
$('#topbarregister').on('click',function (event){
wpestate_show_login_form(2, 0, 0);
});
price_low_val=parseFloat($('#price_low').val(), 10);
price_max_val=parseFloat($('#price_max').val(), 10);
if(jQuery('#slider_price').length>0){
wpestate_enable_slider('slider_price', 'price_low', 'price_max', 'amount', my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef,my_custom_curr_label);
}
if(jQuery('#slider_price_widget').length>0){
wpestate_enable_slider('slider_price_widget', 'price_low_widget', 'price_max_widget', 'amount_wd', my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef,my_custom_curr_label);
}
if(jQuery('#slider_price_sh').length>0){
wpestate_enable_slider('slider_price_sh', 'price_low_sh', 'price_max_sh', 'amount_sh', my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef,my_custom_curr_label);
}
if(jQuery('#slider_price_mobile').length>0){
wpestate_enable_slider('slider_price_mobile', 'price_low_mobile', 'price_max_mobile', 'amount_mobile', my_custom_curr_pos, my_custom_curr_symbol, my_custom_curr_cur_post,my_custom_curr_coef,my_custom_curr_label);
}
if(jQuery('#wpestate_slider_radius').length>0){
wpestate_enable_slider_radius('wpestate_slider_radius',control_vars.min_geo_radius, control_vars.max_geo_radius, control_vars.initial_radius);
}
function wpestate_slider_control_left_function(element){
var step_size, margin_left, new_value, last_element, base_value, parent;
parent=element.parent();
step_size=parent.find('.shortcode_slider_list').width();
margin_left=parseFloat(parent.find('.shortcode_slider_list').css('margin-left'), 10);
new_value=margin_left - 389;
base_value=3;
parent.find('.shortcode_slider_list').css('margin-left', new_value + 'px');
last_element=parent.find('.shortcode_slider_list li:last-child');
parent.find('.shortcode_slider_list li:last-child').remove();
parent.find('.shortcode_slider_list').prepend(last_element);
wpestate_restart_js_after_ajax();
parent.find('.shortcode_slider_list').animate({
'margin-left': base_value
}, 800, function (){
});
}
function wpestate_slider_control_right_function(elemenet){
var step_size, margin_left, new_value, first_element, parent;
parent=elemenet.parent();
step_size=parent.find('.shortcode_slider_list').width();
margin_left=parseFloat(parent.find('.shortcode_slider_list').css('margin-left'), 10);
new_value=margin_left - 389;
parent.find('.shortcode_slider_list').animate({
'margin-left': new_value
}, 800, function (){
first_element=parent.find('.shortcode_slider_list li:nth-child(1)');
parent.find('.shortcode_slider_list li:nth-child(1)').remove();
parent.find('.shortcode_slider_list').append(first_element);
parent.find('.shortcode_slider_list').css('margin-left', 3 + 'px');
wpestate_restart_js_after_ajax();
});
}
$('.slider_control_left').on('click',function (){
wpestate_slider_control_left_function($(this));
});
$('.slider_control_right').on('click',function (){
wpestate_slider_control_right_function($(this));
});
$('.slider_container ').each(function(){
var element, wrapper;
element=$(this).find(".slider_control_right");
wrapper=$(this).find(".shortcode_slider_wrapper").attr('data-auto');
autoscroll_slider=parseFloat(wrapper, 10);
if(autoscroll_slider!==0){
setInterval(function (){
wpestate_slider_control_right_function(element);
}, autoscroll_slider);
}});
$('#login_user_topbar,#login_pwd_topbar').on('focus', function (e){
$('#user_menu_open').addClass('iosfixed');
});
$('#estate-carousel .slider-content h3 a,#estate-carousel .slider-content .read_more ').on('click',function (){
var new_link;
new_link=$(this).attr('href');
window.open(new_link, '_self', false);
});
$('#filter_city li').on('click',function (event){
event.preventDefault();
var pick, value_city, parent, selected_city, is_city, area_value;
value_city=String($(this).attr('data-value2')).toLowerCase();
$('#filter_area li').each(function (){
is_city=String($(this).attr('data-parentcity')).toLowerCase();
is_city=is_city.replace(" ", "-");
area_value=String($(this).attr('data-value')).toLowerCase();
if(is_city===value_city||value_city==='all'||is_city==='undefined'){
$(this).show();
}else{
$(this).hide();
}});
});
$('#sidebar_filter_city li').on('click',function (event){
event.preventDefault();
var pick, value_city, parent, selected_city, is_city, area_value;
value_city=String($(this).attr('data-value2')).toLowerCase();
$('#sidebar_filter_area li').each(function (){
is_city=String($(this).attr('data-parentcity')).toLowerCase();
is_city=is_city.replace(" ", "-");
area_value=String($(this).attr('data-value')).toLowerCase();
if(is_city===value_city||value_city==='all'){
$(this).show();
}else{
$(this).hide();
}});
});
$('#adv-search-city li').on('click',function (event){
event.preventDefault();
var pick, value_city, parent, selected_city, is_city, area_value;
value_city=String($(this).attr('data-value2')).toLowerCase();
$('#adv-search-area li').each(function (){
is_city=String($(this).attr('data-parentcity')).toLowerCase();
is_city=is_city.replace(" ", "-");
area_value=String($(this).attr('data-value')).toLowerCase();
if(is_city===value_city||value_city==='all'){
$(this).show();
}else{
$(this).hide();
}});
});
$('#property_city_submit').change(function (){
var city_value, area_value;
city_value=$(this).val();
all_browsers_stuff=$('#property_area_submit_hidden').html();
$('#property_area_submit').empty().append(all_browsers_stuff);
$('#property_area_submit option').each(function (){
area_value=$(this).attr('data-parentcity');
if(city_value===area_value||area_value==='all'){
}else{
$(this).remove();
}});
});
$('#adv_short_select_city li').on('click',function (event){
event.preventDefault();
var pick, value_city, parent, selected_city, is_city, area_value;
value_city=String($(this).attr('data-value2')).toLowerCase();
$('#adv_short_select_area li').each(function (){
is_city=String($(this).attr('data-parentcity')).toLowerCase();
is_city=is_city.replace(" ", "-");
area_value=String($(this).attr('data-value')).toLowerCase();
if(is_city===value_city||value_city==='all'){
$(this).show();
}else{
$(this).hide();
}});
});
$('#mobile-adv-city li').on('click',function (event){
event.preventDefault();
var pick, value_city, parent, selected_city, is_city, area_value;
value_city=String($(this).attr('data-value2')).toLowerCase();
$('#mobile-adv-area li').each(function (){
is_city=String($(this).attr('data-parentcity')).toLowerCase();
is_city=is_city.replace(" ", "-");
area_value=String($(this).attr('data-value')).toLowerCase();
if(is_city===value_city||value_city==='all'){
$(this).show();
}else{
$(this).hide();
}});
});
$('#adv-search-header-mobile').on('click',function (){
$('#adv-search-mobile').toggle('300');
});
$('.nav-prev,.nav-next ').on('click',function (event){
event.preventDefault();
var link=$(this).find('a').attr('href');
window.open(link, '_self', false);
});
$('.featured_agent_details_wrapper, .agent-listing-img-wrapper').on('click',function (){
var newl=$(this).attr('data-link');
window.open(newl, '_self', false);
});
$('.see_my_list_featured').on('click',function (event){
event.stopPropagation();
});
$('.featured_cover').on('click',function (){
var newl=$(this).attr('data-link');
window.open(newl, '_self', false);
});
jQuery(".agent_face").on("hover", function(event){
if(event.type==="mouseenter"){
$(this).find('.agent_face_details').fadeIn('500');
}else if(event.type==="mouseleave"){
$(this).find('.agent_face_details').fadeOut('500');
}});
$('.agent_unit, .blog_unit,.blog_unit_back,.places_wrapper ,.featured_agent,.places_slider_wrapper_type_1').on('click',function (){
var link;
link=$(this).attr('data-link');
window.open(link, '_self');
});
$('.property_listing').on('click',function (event){
var link, classevent;
classevent=$(event.target);
if(classevent.hasClass('carousel-control')||classevent.hasClass('icon-left-open-big')||classevent.hasClass('icon-right-open-big')){
return;
}
link=$(this).attr('data-link');
window.open(link, '_self');
});
jQuery('#imagelist i').on('click',function (){
var curent='';
jQuery(this).parent().remove();
jQuery('#imagelist .uploaded_images').each(function (){
curent=curent + ',' + jQuery(this).attr('data-imageid');
});
jQuery('#attachid').val(curent);
});
jQuery('#imagelist img').dblclick(function (){
jQuery('#imagelist .uploaded_images .thumber').each(function (){
jQuery(this).remove();
});
jQuery('.fa-star').remove();
jQuery(this).parent().append('
');
jQuery('#attachthumb').val(jQuery(this).parent().attr('data-imageid'));
});
$('.advanced_search_sidebar li').on('click',function (event){
event.preventDefault();
var pick, value, parent;
pick=$(this).text();
value=$(this).attr('data-value');
parent=$(this).parent().parent();
parent.find('.filter_menu_trigger').text(pick).append('').attr('data-value', value);
parent.find('input').val(value);
});
$('.adv-search-mobile li').on('click',function (event){
event.preventDefault();
var pick, value, parent;
pick=$(this).text();
value=$(this).attr('data-value');
parent=$(this).parent().parent();
parent.find('.filter_menu_trigger').text(pick).append('
').attr('data-value', value);
parent.find('input').val(value);
});
$('#switch').on('click',function (){
$('.main_wrapper').toggleClass('wide');
});
$('#accordion_prop_addr, #accordion_prop_details, #accordion_prop_features, #yelp_details').on('shown.bs.collapse', function (){
$(this).find('h4').removeClass('carusel_closed');
});
$('#accordion_prop_addr, #accordion_prop_details, #accordion_prop_features, #yelp_details').on('hidden.bs.collapse', function (){
$(this).find('h4').addClass('carusel_closed');
});
$('#adv-search-5 li,#adv-search-4 li,#adv-search-3 li,#adv-search-1 li,#advanced_search_shortcode li,#advanced_search_map_list li').on('click',function (){
var pick, value, parent;
pick=$(this).text();
value=$(this).attr('data-value');
parent=$(this).parent().parent();
parent.find('.filter_menu_trigger').text(pick).append('
').attr('data-value', value);
parent.find('input').val(value);
});
$('.advanced_search_map_list_container li').on('click',function (){
wpestate_start_filtering_ajax_map(1);
});
$('.advanced_search_map_list_container_trigger input[type="text"]').change(function (){
if($(this).attr('id')!=='search_location'&&$(this).attr('id')!=='check_in'){
wpestate_start_filtering_ajax_map(1);
}});
$('#check_out_list').change(function (){
var start_date=$('#check_in_list').val();
if(start_date!==''){
wpestate_start_filtering_ajax_map(1);
}});
$('#check_out_list').change(function (){
var start_date=$('#check_in_list').val();
if(start_date!==''){
wpestate_start_filtering_ajax_map(1);
}});
$('#extended_search_check_filter input[type="checkbox"]').on('click',function (){
wpestate_start_filtering_ajax_map(1);
});
$("#google_map_prop_list_sidebar #slider_price").slider({
stop: function (event, ui){
wprentals_show_pins();
wpestate_start_filtering_ajax_map(1);
}});
$('#showinpage,#showinpage_mobile').on('click',function (event){
event.preventDefault();
if($('#gmap-full').hasClass('spanselected')){
$('#gmap-full').trigger('click');
}
wpestate_start_filtering(1);
});
$('#openmap').on('click',function (){
if($(this).find('i').hasClass('fa-angle-down')){
$(this).empty().append('
' + control_vars.close_map);
if(control_vars.show_adv_search_map_close==='no'){
$('.search_wrapper').addClass('adv1_close');
adv_search_click();
}}else{
$(this).empty().append('
' + control_vars.open_map);
}
wpestate_new_open_close_map(2);
});
$('#gmap-full').on('click',function (){
if($('#gmap_wrapper').hasClass('fullmap')){
$('#gmap_wrapper').removeClass('fullmap').css('height', wrap_h + 'px');
$('#googleMap').removeClass('fullmap').css('height', map_h + 'px');
$('#search_wrapper').removeClass('fullscreen_search');
$('#search_wrapper').removeClass('fullscreen_search_open');
$('.master_header').removeClass('hidden');
$('#gmap-controls-wrapper ').removeClass('fullscreenon');
$('.content_wrapper,#colophon,#openmap').show();
$('#gmap-controls-wrapper ').removeClass('fullscreenon');
$('body,html').animate({
scrollTop: 0
}, "slow");
$('#openmap').show();
$(this).removeClass('spanselected');
}else{
wrap_h=$('#gmap_wrapper').outerHeight();
map_h=$('#googleMap').outerHeight();
$('#gmap_wrapper,#googleMap').css('height', '100%').addClass('fullmap');
$('#search_wrapper').addClass('fullscreen_search');
$('.master_header ').addClass('hidden');
$('.content_wrapper,#colophon,#openmap').hide();
$('#gmap-controls-wrapper ').addClass('fullscreenon');
$(this).addClass('spanselected');
}
if($('#google_map_prop_list_wrapper').hasClass('halfmapfull')){
$('#google_map_prop_list_wrapper').removeClass('halfmapfull');
$('#google_map_prop_list_wrapper').removeClass('halfmapfullx');
$('.master_header').removeClass('hidden');
$('#gmap-controls-wrapper ').removeClass('fullscreenon');
$(this).removeClass('spanselected');
}else{
$('#google_map_prop_list_wrapper').addClass('halfmapfull');
$('#google_map_prop_list_wrapper').addClass('halfmapfullx');
}
wprentals_map_resize();
});
$('#street-view').on('click',function (){
wpestate_toggleStreetView();
});
$('.videoitem iframe').on('click',function (){
$('.estate_video_control').remove();
});
jQuery(".icon-fav, .share_list, .compare-action, .dashboad-tooltip, .pack-name, .normal_list_no, .mess_tooltip").on("hover", function(event){
if(event.type==="mouseenter"){
$(this).tooltip('show');
}else if(event.type==="mouseleave"){
$(this).tooltip('hide');
}});
$('.share_list').on('click',function (event){
event.stopPropagation();
var sharediv=$(this).parent().find('.share_unit');
sharediv.toggle();
$(this).toggleClass('share_on');
});
$('.backtop').on('click',function (event){
event.preventDefault();
$('body,html').animate({
scrollTop: 0
}, "slow");
});
$(".fancybox-thumb").lazyload();
$(".fancybox-thumb").fancybox({
prevEffect:'none',
nextEffect:'none',
helpers:{
title:{
type: 'outside'
},
thumbs:{
width:100,
height:100
}}
});
$('#carousel-listing .item img').on('click',function (){
$("a[rel^='data-fancybox-thumb']:first").click();
});
$('.imagebody_new .image_gallery').on('click',function (){
$("a[rel^='data-fancybox-thumb']:first").click();
});
jQuery("#geolocation-button").on("hover", function(event){
if(event.type==="mouseenter"){
$('#tooltip-geolocation').fadeIn();
$('.tooltip').fadeOut("fast");
}else if(event.type==="mouseleave"){
$('#tooltip-geolocation').fadeOut();
}})
$('.extra_featured').change(function(){
var parent=$(this).parent();
var price_regular=parseFloat(parent.find('.submit-price-no').text(),10);
var price_featured=parseFloat(parent.find('.submit-price-featured').text(),10);
var total=price_regular+price_featured;
if($(this).is(':checked')){
parent.find('.submit-price-total').text(total);
parent.find('#stripe_form_featured').show();
parent.find('#stripe_form_simple').hide();
}else{
parent.find('.submit-price-total').text(price_regular);
parent.find('#stripe_form_featured').hide();
parent.find('#stripe_form_simple').show();
}
wpestate_enable_stripe_booking_prop();
});
$('.compare_wrapper').each(function (){
var cols=$(this).find('.compare_item_head').length;
$(this).addClass('compar-' + cols);
});
$('#list_view').on('click',function (){
$(this).toggleClass('icon_selected');
$('#listing_ajax_container').addClass('ajax12');
$('#grid_view').toggleClass('icon_selected');
$('.listing_wrapper').hide().removeClass('col-md-4').removeClass('col-md-3').addClass('col-md-12').fadeIn(400);
$('.the_grid_view').fadeOut(10, function (){
$('.the_list_view').fadeIn(300);
});
});
$('#grid_view').on('click',function (){
var class_type;
class_type=$('.listing_wrapper:first-of-type').attr('data-org');
$(this).toggleClass('icon_selected');
$('#listing_ajax_container').removeClass('ajax12');
$('#list_view').toggleClass('icon_selected');
$('.listing_wrapper').hide().removeClass('col-md-12').addClass('col-md-' + class_type).fadeIn(400);
$('.the_list_view').fadeOut(10, function (){
$('.the_grid_view').fadeIn(300);
});
});
$('#add-new-image').on('click',function (){
$('
New Image:
').appendTo('#files_area');
});
$('.delete_image').on('click',function (){
var image_id=$(this).attr('data-imageid');
curent=$('#images_todelete').val();
if(curent===''){
curent=image_id;
}else{
curent=curent + ',' + image_id;
}
$('#images_todelete').val(curent);
$(this).parent().remove();
});
$('#googleMap').bind('mousemove', function (e){
$('.tooltip').css({'top': e.pageY, 'left': e.pageX, 'z-index': '1'});
});
setTimeout(function (){
$('.tooltip').fadeOut("fast");
}, 10000);
});
function wpestate_show_capture(){
"use strict";
var position, slideno, slidedif, tomove, curentleft;
jQuery('#googleMapSlider').hide();
position=parseFloat(jQuery('#carousel-listing .carousel-inner .active').index(), 10);
jQuery('#carousel-listing .caption-wrapper span').removeClass('active');
jQuery("#carousel-listing .caption-wrapper span[data-slide-to='" + position + "'] ").addClass('active');
slideno=position + 1;
slidedif=slideno * 146;
if(slidedif > 810){
tomove=810 - slidedif;
jQuery('.post-carusel .carousel-indicators').css('left', tomove + "px");
}else{
position=jQuery('.post-carusel .carousel-indicators').css('left', tomove + "px").position();
curentleft=position.left;
if(curentleft < 0){
tomove=0;
jQuery('.post-carusel .carousel-indicators').css('left', tomove + "px");
}}
}
function wpestate_shortcode_google_map_load(containermap, lat, long, mapid){
"use strict";
var myCenter, mapOptions, map, marker;
myCenter=new google.maps.LatLng(lat, long);
mapOptions={
flat: false,
noClear: false,
zoom: 15,
scrollwheel: false,
draggable: true,
center: myCenter,
mapTypeId: google.maps.MapTypeId.ROADMAP,
streetViewControl: false,
mapTypeControlOptions: {
mapTypeIds: [google.maps.MapTypeId.ROADMAP]
},
disableDefaultUI: true,
gestureHandling: 'cooperative'
};
map=new google.maps.Map(document.getElementById(mapid), mapOptions);
google.maps.visualRefresh=true;
marker=new google.maps.Marker({
position: myCenter,
map: map
});
marker.setMap(map);
}
function wpestate_enable_stripe_booking_prop(){
jQuery('.wpestate_stripe_booking_prop').unbind();
jQuery('.wpestate_stripe_booking_prop').on('click',function(){
var parent=jQuery(this).parent();
var modalid=jQuery(this).attr('data-modalid');
jQuery('#'+modalid).show();
jQuery('#'+modalid+' .wpestate_stripe_form_1').show();
wpestate_start_stripe(0,modalid);
});
jQuery('.close_stripe_form').on('click',function(){
jQuery('.wpestate_stripe_form_wrapper').hide();
jQuery('.wpestate_stripe_form_1').hide();
});
};
jQuery(document).ready(function ($){
"use strict";
$('#allinone_set_custom').on('click',function(event){
$('#allinone_set_custom').text(ajaxcalls_vars.saving);
if(jQuery('#block_dates').is(':checked')){
wpestate_check_booking_valability_internal_allinone();
}else{
wpestate_allinone_owner_insert_customprice_internal();
}});
function wpestate_allinone_owner_insert_customprice_internal(){
var period_extra_price_per_guest, period_price_per_weekeend, period_checkin_change_over, period_checkin_checkout_change_over, period_min_days_booking,start_from, end_to, listing_edit, new_price, ajaxurl;
start_from=jQuery('#start_date_owner_book').val();
end_to=jQuery('#end_date_owner_book').val();
listing_edit=jQuery('#property_id').val();
new_price=jQuery('#new_custom_price').val();
period_min_days_booking=jQuery('#period_min_days_booking').val();
period_extra_price_per_guest=jQuery('#period_extra_price_per_guest').val();
period_price_per_weekeend=jQuery('#period_price_per_weekeend').val();
period_checkin_change_over=jQuery('#period_checkin_change_over').val();
period_checkin_checkout_change_over=jQuery('#period_checkin_checkout_change_over').val();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
var nonce=jQuery('#wprentals_allinone').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_add_allinone_custom',
'book_from':start_from,
'book_to':end_to,
'listing_id':listing_edit,
'new_price':new_price,
'period_min_days_booking':period_min_days_booking,
'period_extra_price_per_guest':period_extra_price_per_guest,
'period_price_per_weekeend':period_price_per_weekeend,
'period_checkin_change_over':period_checkin_change_over,
'period_checkin_checkout_change_over':period_checkin_checkout_change_over,
'security':nonce,
},
success: function (data){
location.reload();
},
error: function (errorThrown){
}});
}
function wpestate_check_booking_valability_internal_allinone(){
var book_from, book_to, listing_edit, ajaxurl,internal,hour_from,hour_to;
jQuery('#book_dates').empty().text(ajaxcalls_vars.saving);
book_from=jQuery('#start_date_owner_book').val();
book_to=jQuery('#end_date_owner_book').val();
if(jQuery('#start_date_owner_book_hour').length>0){
hour_from=jQuery('#start_date_owner_book_hour').val();
book_from=book_from+' '+hour_from;
hour_to=jQuery('#end_date_owner_book_hour').val();
book_to=book_to+' '+hour_to;
}
listing_edit=jQuery('#listing_edit').val();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
internal=1;
var nonce=jQuery('#wprentals_allinone').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_check_booking_valability_internal',
'book_from':book_from,
'book_to':book_to,
'listing_id':listing_edit,
'internal':internal,
'security':nonce,
'allinone':1
},
success: function (data){
if(data.trim()==='run'){
wpestate_allin_one_owner_insert_book_internal();
}else{
jQuery('#book_dates').empty().text(ajaxcalls_vars.reserve);
}},
error: function (errorThrown){
}});
}
function wpestate_allin_one_owner_insert_book_internal(){
var fromdate, todate, listing_edit, nonce, ajaxurl, comment, booking_guest_no,hour_from,hour_to;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
fromdate=jQuery("#start_date_owner_book").val();
todate=jQuery("#end_date_owner_book").val();
listing_edit=jQuery('#listing_edit').val();
comment=jQuery("#book_notes").val();
booking_guest_no=jQuery('#booking_guest_no_wrapper').attr('data-value');
if(jQuery('#start_date_owner_book_hour').length>0){
hour_from=jQuery('#start_date_owner_book_hour').val();
fromdate=fromdate+' '+hour_from;
hour_to=jQuery('#end_date_owner_book_hour').val();
todate=todate+' '+hour_to;
}
var nonce=jQuery('#wprentals_allinone').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_add_booking',
'fromdate':fromdate,
'todate':todate,
'listing_edit':listing_edit,
'comment':comment,
'booking_guest_no':booking_guest_no,
'confirmed':1,
'security':nonce,
'allinone':1
},
success: function (data){
wpestate_allinone_owner_insert_customprice_internal();
},
error: function (errorThrown){
}});
}
var all_calendar_click=0;
var curent_id;
$('.booking-calendar-wrapper-allinone .has_future').on('click',function (event){
var has_reservation, parent, detect_start, start_date, end_date;
has_reservation=0;
detect_start=0;
if($(this).hasClass('calendar-reserved')||$(this).hasClass('pick_block_dates')){
return;
}else{
$(this).addClass('calendar-selected');
}
if(all_calendar_click===0){
all_calendar_click=1;
$(this).addClass('calendar-reserved-start');
curent_id=$(this).attr('data-curent-id');
$('.booking-calendar-wrapper-allinone .has_future[data-curent-id!='+curent_id+']').addClass('pick_block_dates');
}else{
var curent_id=$(this).attr('data-curent-id');
all_calendar_click=0;
$(this).addClass('calendar-reserved-stop');
parent=$(this).parent().parent();
$('.has_future[data-curent-id="'+curent_id+'"]').each(function (){
if($(this).hasClass('calendar-reserved-start')){
detect_start=1;
start_date=$(this).attr('data-curent-date');
}
if(detect_start===1){
if($(this).hasClass('calendar-reserved')){
has_reservation=1;
}}
if($(this).hasClass('calendar-reserved-stop')){
detect_start=0;
end_date=$(this).attr('data-curent-date');
}});
$('.clean_reservation').show();
if(has_reservation==1){
$('.clean_reservation').hide();
}
$('.booking-calendar-wrapper-allinone .calendar-selected').removeClass('calendar-selected ');
$('.booking-calendar-wrapper-allinone .has_future').removeClass('pick_block_dates calendar-reserved-stop calendar-reserved-start');
allinone_mark_as_booked(parent, start_date, end_date,curent_id);
}});
function allinone_mark_as_booked(parent, start_date, end_date,curent_id){
jQuery('#allinone_reservation_modal').modal();
var date_format=control_vars.date_format.toUpperCase();
start_date=moment.unix(start_date).utc().format(date_format);
jQuery('#start_date_owner_book').val(start_date);
end_date=moment.unix(end_date).utc().format(date_format);
jQuery('#end_date_owner_book').val(end_date);
jQuery('#property_id').val(curent_id);
jQuery('#listing_edit').val(curent_id);
}
$('.delete_custom_period a').on('click',function (event){
event.preventDefault();
var parent,ajaxurl, edit_id,from_date,to_date;
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
edit_id=parseInt(jQuery(this).parent().attr('data-editid'),10);
from_date=parseInt(jQuery(this).parent().attr('data-fromdate'),10);
to_date=parseInt(jQuery(this).parent().attr('data-todate'),10);
parent=jQuery(this).parent().parent();
var nonce=jQuery('#wprentals_delete_custom_period_nonce').val();
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_delete_custom_period',
'edit_id':edit_id,
'from_date':from_date,
'to_date':to_date,
'security':nonce
},
success: function (data){
parent.remove();
location.reload();
},
error: function (errorThrown){
}});
});
$('#form_submit_1').on('click',function (){
if(!$(this).hasClass('externalsubmit')){
return;
}
jQuery(this).unbind('click');
var property_affiliate,security,ajaxurl,title,prop_category,prop_action_category,property_city,property_area_front,property_country,property_description,guest_no,new_estate,instant_booking;
title=jQuery('#title').val();
prop_category=jQuery('#prop_category_submit').val();
prop_action_category=jQuery('#prop_action_category_submit').val();
property_city=jQuery('#property_city').val();
if(property_city===''||typeof(property_city)==='undefined'){
property_city=jQuery('#property_city_front_autointernal').val();
}
instant_booking=0;
if(jQuery('#instant_booking').is(':checked')){
instant_booking=1;
}
property_area_front=jQuery('#property_area_front').val();
property_country=jQuery('#property_country').val();
property_description=jQuery('#property_description').val();
guest_no=jQuery('#guest_no').val();
property_affiliate=jQuery('#property_affiliate').val();
new_estate=jQuery('#new_estate').val();
security=jQuery('#security-login-submit').val();
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
if(wpestate_check_for_mandatory()){
$([document.documentElement, document.body]).animate({
scrollTop: $("#new_post").offset().top
}, 500);
return;
}
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_front_end_submit',
'title':title,
'prop_category':prop_category,
'prop_action_category':prop_action_category,
'property_city':property_city,
'property_area_front':property_area_front,
'property_country':property_country,
'property_description':property_description,
'guest_no':guest_no,
'new_estate':new_estate,
'instant_booking':instant_booking,
'property_affiliate':property_affiliate,
'security':security
},
success: function (data){
jQuery("#new_estate").val('');
jQuery('#wp-login-but').attr('data-mixval',data);
wpestate_show_login_form(1,0,data);
},
error: function (errorThrown){
}});
});
var curent_m,curent_m_set, input , defaultBounds, options, componentForm, autocomplete, place, calendar_click, calendar_click_price;
curent_m=2;
curent_m_set=1;
var max_month=parseInt(ajaxcalls_vars.max_month_no);
$('#calendar-next').on('click',function (){
if(curent_m < (max_month-2)){
curent_m=curent_m + 1;
}else{
curent_m=max_month;
}
$('.booking-calendar-wrapper').hide();
$('.booking-calendar-wrapper').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m||curent===curent_m + 1){
$(this).fadeIn();
}});
});
$('#calendar-prev').on('click',function (){
if(curent_m > 3){
curent_m=curent_m - 1;
}else{
curent_m=2;
}
$('.booking-calendar-wrapper').hide();
$('.booking-calendar-wrapper').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m||curent===curent_m - 1){
$(this).fadeIn();
}});
});
$('#calendar-next-internal').on('click',function (){
if(curent_m < (max_month-2)){
curent_m=curent_m + 1;
}else{
curent_m=max_month-1;
}
$(".booking-calendar-wrapper-in").hide();
$('.booking-calendar-wrapper-in').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m||curent===curent_m + 1||curent===curent_m + 2){
$(this).css('display','inline-block');
}});
});
$('#calendar-prev-internal').on('click',function (){
if(curent_m > 3){
curent_m=curent_m - 1;
}else{
curent_m=3;
}
$('.booking-calendar-wrapper-in').hide();
$('.booking-calendar-wrapper-in').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m||curent===curent_m - 1||curent===curent_m - 2){
$(this).css('display','inline-block');
}});
});
$('#calendar-prev-internal-set').on('click',function (){
if(curent_m_set > 1){
curent_m_set=curent_m_set - 1;
}else{
curent_m_set=1;
}
$('.booking-calendar-wrapper-in').hide();
$('.booking-calendar-wrapper-in').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m_set){
$(this).css('display','inline-block');
}});
});
$('#calendar-next-internal-set').on('click',function (){
if(curent_m_set < (max_month-2)){
curent_m_set=curent_m_set + 1;
}else{
curent_m_set=max_month-1;
}
$(".booking-calendar-wrapper-in").hide();
$('.booking-calendar-wrapper-in').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m_set){
$(this).css('display','inline-block');
}});
});
$('#calendar-prev-internal-allinone').on('click',function (){
if(curent_m_set > 1){
curent_m_set=curent_m_set - 1;
}else{
curent_m_set=1;
}
$('.booking-calendar-wrapper-allinone').hide();
$('.booking-calendar-wrapper-allinone').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m_set){
$(this).css('display','inline-block');
}});
});
$('#calendar-next-internal-allinone').on('click',function (){
if(curent_m_set < (max_month-2)){
curent_m_set=curent_m_set + 1;
}else{
curent_m_set=max_month-1;
}
$(".booking-calendar-wrapper-allinone ").hide();
$('.booking-calendar-wrapper-allinone ').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m_set){
$(this).css('display','inline-block');
}});
});
$('#calendar-next-internal-price').on('click',function (){
if(curent_m < (max_month-2)){
curent_m=curent_m + 1;
}else{
curent_m=max_month-1;
}
$(".booking-calendar-wrapper-in-price").hide();
$('.booking-calendar-wrapper-in-price').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m||curent===curent_m + 1){
$(this).fadeIn();
}});
});
$('#calendar-prev-internal-price').on('click',function (){
if(curent_m > 2){
curent_m=curent_m - 1;
}else{
curent_m=2;
}
$('.booking-calendar-wrapper-in-price').hide();
$('.booking-calendar-wrapper-in-price').each(function (){
var curent;
curent=parseInt($(this).attr('data-mno'), 10);
if(curent===curent_m||curent===curent_m - 1){
$(this).fadeIn();
}});
});
$('#close_custom_price_internal').on('click',function (){
$('.booking-calendar-wrapper-in-price td').each(function (){
$(this).removeClass('calendar-reserved-start-price');
$(this).removeClass('calendar-reserved-stop-price');
$(this).removeClass('calendar-reserved-price');
});
});
$('#close_reservation_internal').on('click',function (){
var start_remove=0;
$('.calendar-reserved').each(function (){
if($(this).hasClass('calendar-reserved-start')){
$(this).removeClass('calendar-reserved-start');
$(this).removeClass('calendar-reserved');
start_remove=1;
}
if(start_remove===1){
$(this).removeClass('calendar-reserved');
}
if($(this).hasClass('calendar-reserved-stop')){
$(this).removeClass('calendar-reserved-stop');
$(this).removeClass('calendar-reserved');
start_remove=0;
}});
});
if(typeof google==='object'&&typeof google.maps==='object'&&parseInt(mapbase_vars.wprentals_places_type)==1){
input=(document.getElementById('property_city_front'));
defaultBounds=new google.maps.LatLngBounds(new google.maps.LatLng(-90, -180),
new google.maps.LatLng(90, 180)
);
options={
bounds: defaultBounds,
types: ['(cities)'],
};
componentForm={
establishment: 'long_name',
street_number: 'short_name',
route: 'long_name',
locality: 'long_name',
administrative_area_level_1: 'long_name',
administrative_area_level_2: 'long_name',
administrative_area_level_3: 'long_name',
administrative_area_level_4: 'long_name',
country: 'long_name',
postal_code: 'short_name',
postal_code_prefix: 'short_name',
neighborhood: 'long_name',
colloquial_area:'long_name',
natural_feature:'long_name'
};
if(document.getElementById('property_city_front')){
autocomplete=new google.maps.places.Autocomplete(input, options);
google.maps.event.addListener(autocomplete, 'place_changed', function (){
place=autocomplete.getPlace();
wprentals_google_fillInAddress(place);
});
}}
function wprentals_google_fillInAddress(place){
var i, addressType, temp, val ,have_city,admin_area;
have_city=0;
admin_area='';
var pyrmont=new google.maps.LatLng(-33.8665433,151.1956316);
var map_city=new google.maps.Map(document.getElementById('property_country'), {
center: pyrmont,
zoom: 15
});
for (i=0; i < place.address_components.length; i++){
addressType=place.address_components[i].types[0];
temp='';
val=place.address_components[i][componentForm[addressType]];
if(addressType==='street_number'||addressType==='route'){
}else if(addressType==='neighborhood'){
}else if(addressType==='postal_code_prefix'){
}else if(addressType==='postal_code'){
}else if(addressType==='administrative_area_level_4'){
admin_area=wpestate_build_admin_area(admin_area,val);
}else if(addressType==='administrative_area_level_3'){
admin_area=wpestate_build_admin_area(admin_area,val);
}else if(addressType==='administrative_area_level_2'){
admin_area=wpestate_build_admin_area(admin_area,val);
}else if(addressType==='administrative_area_level_1'){
admin_area=wpestate_build_admin_area(admin_area,val);
}else if(addressType==='locality'){
$('#property_city').val(val); have_city=1;
}else if(addressType==='colloquial_area'){
$('#property_city').val(val); have_city=1;
}else if(addressType==='country'||addressType==='natural_feature'){
$('#property_country').val(val); have_city=1;
}else{
}
if(have_city===0){
wpestate_second_measure_city_submit('property_city',place.adr_address);
}}
if($('#property_city').val()!==''){
$('#property_admin_area').val($('#property_city').val()+", "+admin_area);
}}
function wpestate_second_measure_city_submit(stringplace,adr_address){
var new_city;
new_city=$(adr_address).filter('span.locality').html() ;
$('#'+stringplace).val(new_city);
}
function wpestate_build_admin_area(admin_area,val,map_city){
if(admin_area===''){
admin_area=admin_area+val;
}else{
admin_area=admin_area+", "+val;
}
$('#property_admin_area').val(admin_area);
return admin_area;
}
function wpestate_translate_google_fuckups(translate){
var request={
query: translate
};
var service=new google.maps.places.PlacesService(map_city);
service.textSearch(request, callback);
}
function callback(results, status){
if(status==google.maps.places.PlacesServiceStatus.OK){
}}
function wpestate_custom_price_set(parent, start_date, end_date){
jQuery('#owner_price_modal').modal();
jQuery('#start_date_owner_book').val(wpestate_convert_selected_days_reverse(wpestate_timeConverter_noconver(start_date)));
jQuery('#end_date_owner_book').val(wpestate_convert_selected_days_reverse(wpestate_timeConverter_noconver(end_date)));
wpestate_mark_as_price_actions();
}
function wpestate_mark_as_price_actions(){
var period_price_per_month,period_price_per_week,period_extra_price_per_guest, period_price_per_weekeend, period_checkin_change_over, period_checkin_checkout_change_over, period_min_days_booking,start_from, end_to, listing_edit, new_price, ajaxurl;
$('#set_price_dates').on('click',function (){
jQuery('#book_dates').empty().text(ajaxcalls_vars.saving);
start_from=jQuery('#start_date_owner_book').val();
end_to=jQuery('#end_date_owner_book').val();
listing_edit=jQuery('#listing_edit').val();
new_price=jQuery('#new_custom_price').val();
period_min_days_booking=jQuery('#period_min_days_booking').val();
period_extra_price_per_guest=jQuery('#period_extra_price_per_guest').val();
period_price_per_weekeend=jQuery('#period_price_per_weekeend').val();
period_checkin_change_over=jQuery('#period_checkin_change_over').val();
period_checkin_checkout_change_over=jQuery('#period_checkin_checkout_change_over').val();
period_price_per_week=jQuery('#period_week_price').val();
period_price_per_month=jQuery('#period_month_price').val();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
var nonce=jQuery('#wprentals_custom_price').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_add_custom_price',
'book_from':start_from,
'book_to':end_to,
'listing_id':listing_edit,
'new_price':new_price,
'period_min_days_booking':period_min_days_booking,
'period_extra_price_per_guest':period_extra_price_per_guest,
'period_price_per_weekeend':period_price_per_weekeend,
'period_checkin_change_over':period_checkin_change_over,
'period_checkin_checkout_change_over':period_checkin_checkout_change_over,
'period_price_per_week':period_price_per_week,
'period_price_per_month':period_price_per_month,
'security':nonce,
},
success: function (data){
jQuery(this).removeClass('calendar-reserved-stop-price');
jQuery(this).removeClass('calendar-reserved-start-price');
jQuery('#owner_price_modal').modal('hide');
jQuery('.booking-calendar-wrapper-in-price .calendar-reserved-price .price-day').remove();
jQuery('.booking-calendar-wrapper-in-price .calendar-reserved-price .custom_set_price').remove();
jQuery('.booking-calendar-wrapper-in-price .calendar-reserved-price').append('
'+data+' ');
jQuery('.booking-calendar-wrapper-in-price .calendar-reserved-price').removeClass('calendar-reserved-price,calendar-reserved-start-price,calendar-reserved-stop-price');
jQuery('#book_dates').empty().text(ajaxcalls_vars.reserve);
jQuery('#book_notes').val('');
jQuery('.booking-calendar-wrapper-in-price td').removeClass('calendar-reserved-stop-price');
jQuery('.booking-calendar-wrapper-in-price td').removeClass('calendar-reserved-start-price');
jQuery('.booking-calendar-wrapper-in-price td').removeClass('calendar-reserved-price');
location.reload();
},
error: function (errorThrown){
}});
});
}
function wpestate_mark_as_booked(parent, start_date, end_date){
jQuery('#owner_reservation_modal').modal();
var date_format=control_vars.date_format.toUpperCase();
start_date=moment.unix(start_date).utc().format(date_format);
jQuery('#start_date_owner_book').val(start_date);
end_date=moment.unix(end_date).utc().format(date_format);
jQuery('#end_date_owner_book').val(end_date);
wpestate_mark_as_booked_actions();
}
function wpestate_mark_as_booked_actions(){
$('#book_dates').unbind('click');
$('#book_dates').on('click',function (){
wpestate_check_booking_valability_internal();
});
}
calendar_click=0;
$('.booking-calendar-wrapper-in .has_future').on('click',function (event){
if($(this).hasClass('calendar-reserved')){
if(!$(this).hasClass('start_reservation')){
return;
}else{
if(calendar_click===0){
return;
}else{
$(this).addClass('calendar-selected');
}}
}else{
$(this).addClass('calendar-selected');
}
var parent, detect_start, start_date, end_date;
detect_start=0;
if(calendar_click===0){
calendar_click=1;
$(this).addClass('calendar-reserved-start');
}else{
calendar_click=0;
$(this).addClass('calendar-reserved-stop');
parent=$(this).parent().parent();
$('.has_future').each(function (){
if($(this).hasClass('calendar-reserved-start')){
detect_start=1;
start_date=$(this).attr('data-curent-date');
}
if($(this).hasClass('calendar-reserved-stop')){
detect_start=0;
$(this).addClass('calendar-reserved');
end_date=$(this).attr('data-curent-date');
}
if(detect_start===1){
$(this).addClass('calendar-reserved');
}});
$('.booking-calendar-wrapper-in .calendar-selected').removeClass('calendar-selected');
wpestate_mark_as_booked(parent, start_date, end_date);
}});
calendar_click_price=0;
$('.booking-calendar-wrapper-in-price .has_future').on('click',function (){
$(this).addClass('calendar-selected');
var parent, detect_start, start_date, end_date;
detect_start=0;
if(calendar_click_price===0){
calendar_click_price=1;
$(this).addClass('calendar-reserved-start-price');
}else{
calendar_click_price=0;
$(this).addClass('calendar-reserved-stop-price');
parent=$(this).parent().parent();
$('.has_future').each(function (){
if($(this).hasClass('calendar-reserved-start-price')){
detect_start=1;
start_date=$(this).attr('data-curent-date');
}
if($(this).hasClass('calendar-reserved-stop-price')){
detect_start=0;
$(this).addClass('calendar-reserved-price');
end_date=$(this).attr('data-curent-date');
}
if(detect_start===1){
$(this).addClass('calendar-reserved-price');
}});
$('.booking-calendar-wrapper-in-price .calendar-selected').removeClass('calendar-selected');
wpestate_custom_price_set(parent, start_date, end_date);
}});
function wpestate_timeConverter_noconver(UNIX_timestamp){
var a, year, month, date, time;
a=new Date(UNIX_timestamp * 1000);
year=a.getUTCFullYear();
month=a.getUTCMonth() + 1;
date=a.getUTCDate();
time=year + '-' + ('0' + month).slice(-2) + '-' + date;
return time;
}
function wpestate_timeConverter(UNIX_timestamp){
var a, year, month, date, time;
var d=new Date();
var n=d.getTimezoneOffset();
a=new Date(UNIX_timestamp * 1000+n*60000);
year=a.getUTCFullYear();
month=a.getMonth() + 1;
date=a.getDate();
time=year + '-' + ('0' + month).slice(-2) + '-' + date;
return time;
}
$('#edit_prop_ammenities').on('click',function (){
var jsonData, ajaxurl, listing_edit, custom_fields_amm, counter, i;
listing_edit=jQuery('#listing_edit').val();
custom_fields_amm='';
$('.feature_list_save').each(function(){
if($(this).prop('checked')){
custom_fields_amm=custom_fields_amm+$(this).attr('data-feature')+"~";
}});
wpestate_scrollToAnchor('all_wrapper');
if(wpestate_check_for_mandatory(1)){
return;
}
var nonce=jQuery('#wprentals_amm_features_nonce').val();
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
$('#profile_message').empty().append('
' + ajaxcalls_vars.saving + '
');
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_update_listing_ammenities',
'listing_edit':listing_edit,
'custom_fields_amm':custom_fields_amm,
'security':nonce
},
success: function (data){
if(data.edited){
$('#profile_message').empty().append('
' + data.response + '
');
}else{
$('#profile_message').empty().append('
' + data.response + '
');
}
var redirect=jQuery('.next_submit_page').attr('href');
window.location=redirect;
},
error: function (errorThrown){
}});
});
$('#edit_prop_locations').on('click',function (){
var jsonData, ajaxurl, listing_edit, property_county, property_state, property_address, property_zip, property_latitude, property_longitude, google_camera_angle, property_google_view;
jsonData=JSON.parse(ajaxcalls_add_vars.tranport_custom_array);
property_address=jQuery('#property_address').val();
property_zip=jQuery('#property_zip').val();
property_county=jQuery('#property_county').val();
property_state=jQuery('#property_state').val();
property_latitude=jQuery('#property_latitude').val();
property_longitude=jQuery('#property_longitude').val();
google_camera_angle=jQuery('#google_camera_angle').val();
listing_edit=jQuery('#listing_edit').val();
wpestate_scrollToAnchor('all_wrapper');
if(wpestate_check_for_mandatory()){
return;
}
var nonce=jQuery('#wprentals_edit_prop_locations_nonce').val();
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
$('#profile_message').empty().append('
' + ajaxcalls_vars.saving + '
');
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_update_listing_location',
'property_address':property_address,
'property_zip':property_zip,
'property_latitude':property_latitude,
'property_longitude':property_longitude,
'google_camera_angle':google_camera_angle,
'property_state':property_state,
'property_county':property_county,
'listing_edit':listing_edit,
'security':nonce
},
success: function (data){
if(data.edited){
$('#profile_message').empty().append('
' + data.response + '
');
}else{
$('#profile_message').empty().append('
' + data.response + '
');
}
var redirect=jQuery('.next_submit_page').attr('href');
window.location=redirect;
},
error: function (errorThrown){
}});
});
$('#edit_calendar').on('click',function (){
var jsonData, ajaxurl, listing_edit, property_icalendar_import,array_labels,array_feeds;
property_icalendar_import=jQuery('#property_icalendar_import').val();
listing_edit=jQuery('#listing_edit').val();
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
$('#profile_message2').empty().append('
' + ajaxcalls_vars.saving + '
');
array_labels=[];
$('.property_icalendar_import_name_new').each(function(){
array_labels.push($(this).val());
});
array_feeds=[];
$('.property_icalendar_import_feed_new').each(function(){
array_feeds.push($(this).val());
});
var nonce=jQuery('#wprentals_edit_calendar_nonce').val();
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_update_ical_feed',
'property_icalendar_import':property_icalendar_import,
'listing_edit':listing_edit,
'array_feeds':array_feeds,
'array_labels':array_labels,
'security':nonce
},
success: function (data){
if(data.edited){
$('#profile_message2').empty().append('
' + data.response + '
');
if(ajaxcalls_add_vars.submit_redirect!==''){
window.setTimeout(function(){
window.location.href=ajaxcalls_add_vars.submit_redirect;
},3000)
}}else{
$('#profile_message2').empty().append('
' + data.response + '
');
}},
error: function (errorThrown){
}});
});
$('.delete_imported_dates_singular').on('click',function(event){
event.preventDefault();
var edit_id,key, ajaxurl,parent;
edit_id=jQuery(this).attr('data-edit-id');
key=jQuery(this).attr('data-edit-id-key');
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
$(this).parent().remove();
var nonce=jQuery('#wprentals_edit_calendar_nonce').val();
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_delete_imported_dates',
'edit_id':edit_id,
'key':key,
'security':nonce
},
success: function (data){
if(data=='done'){
location.reload();
}},
error: function (errorThrown){
}});
});
$('#edit_prop_details').on('click',function (){
"use strict";
var value,temp_opt,i, jsonData, ajaxurl, property_size, property_rooms, property_bedrooms, property_bathrooms, listing_edit, custom_fields_val, variable, counter;
property_size=jQuery('#property_size').val();
property_rooms=jQuery('#property_rooms').val();
property_bedrooms=jQuery('#property_bedrooms').val();
property_bathrooms=jQuery('#property_bathrooms').val();
listing_edit=jQuery('#listing_edit').val();
custom_fields_val='';
jsonData=JSON.parse(ajaxcalls_add_vars.tranport_custom_array);
for (i=0; i < jsonData.length; i++){
counter=jsonData[i];
value=$("#" + counter).val();
if(typeof value==='undefined'){
value='';
}
custom_fields_val=custom_fields_val + "~" + value;
}
wpestate_scrollToAnchor('all_wrapper');
if(wpestate_check_for_mandatory()){
return;
}
var extra_details_options=[];
$('.extra_detail_option_wrapper').each(function(){
temp_opt='';
temp_opt=$(this).find('.extra_option_name').val();
temp_opt=temp_opt + '|' + $(this).find('.extra_option_value ').val();
extra_details_options.push(temp_opt);
});
var beds_options=[];
$('.beds_no ').each(function(){
beds_options.push(jQuery(this).val());
});
var cancellation_policy=jQuery('#cancellation_policy').val();
var other_rules=jQuery('#other_rules').val();
var smoking_allowed=jQuery("input[name='smoking_allowed']:checked"). val();
var pets_allowed=jQuery("input[name='pets_allowed']:checked"). val();
var party_allowed=jQuery("input[name='party_allowed']:checked"). val();
var children_allowed=jQuery("input[name='children_allowed']:checked"). val();
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
$('#profile_message').empty().append('
' + ajaxcalls_vars.saving + '
');
var nonce=jQuery('#wprentals_edit_prop_details_nonce').val();
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_update_listing_details',
'property_size':property_size,
'property_rooms':property_rooms,
'property_bedrooms':property_bedrooms,
'property_bathrooms':property_bathrooms,
'listing_edit':listing_edit,
'custom_fields_val':custom_fields_val,
'extra_details_options':extra_details_options,
'beds_options':beds_options,
'cancellation_policy':cancellation_policy,
'other_rules':other_rules,
'smoking_allowed':smoking_allowed,
'pets_allowed':pets_allowed,
'party_allowed':party_allowed,
'children_allowed':children_allowed,
'security':nonce
},
success: function (data){
if(data.edited){
$('#profile_message').empty().append('
' + data.response + '
');
}else{
$('#profile_message').empty().append('
' + data.response + '
');
}
var redirect=jQuery('.next_submit_page').attr('href');
window.location=redirect;
},
error: function (errorThrown){
}});
});
$('#edit_prop_image').on('click',function (){
var ajaxurl, video_type, video_id, attachid, attachthumb, listing_edit,virtual_tour;
video_type=jQuery('#embed_video_type').val();
video_id=jQuery('#embed_video_id').val();
attachid=jQuery('#attachid').val();
attachthumb=jQuery('#attachthumb').val();
listing_edit=jQuery('#listing_edit').val();
virtual_tour=jQuery('#virtual_tour').val();
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
wpestate_scrollToAnchor('all_wrapper');
if(wpestate_check_for_mandatory()){
return;
}
var nonce=jQuery('#wprentals_edit_prop_image_nonce').val();
$('#profile_message').empty().append('
' + ajaxcalls_vars.saving + '
');
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_update_listing_images',
'video_type':video_type,
'video_id':video_id,
'attachid':attachid,
'attachthumb':attachthumb,
'listing_edit':listing_edit,
'virtual_tour':virtual_tour,
'security':nonce
},
success: function (data){
if(data.edited){
$('#profile_message').empty().append('
' + data.response + '
');
}else{
$('#profile_message').empty().append('
' + data.response + '
');
}
var redirect=jQuery('.next_submit_page').attr('href');
window.location=redirect;
},
error: function (errorThrown){
}});
});
$('#edit_prop_price').on('click',function (){
var booking_start_hour,booking_end_hour,book_type,temp_opt,extra_pay_options,early_bird_days,early_bird_percent,property_price_before_label,property_price_after_label,security_deposit,city_fee_percent,property_taxes,overload_guest,ajaxurl,checkin_checkout_change_over, checkin_change_over, price_per_weekeend,extra_price_per_guest,price_per_guest_from_one, price, price_label, price_week, price_month, listing_edit, city_fee, cleaning_fee,cleaning_fee_per_day,city_fee_per_day,min_days_booking;
book_type=jQuery('#local_booking_type').val();
price=jQuery('#property_price').val();
city_fee=jQuery('#city_fee').val();
cleaning_fee=jQuery('#cleaning_fee').val();
price_label=jQuery('#property_label').val();
price_week=jQuery('#property_price_per_week').val();
price_month=jQuery('#property_price_per_month').val();
listing_edit=jQuery('#listing_edit').val();
property_taxes=jQuery('#property_taxes').val();
cleaning_fee_per_day=jQuery('#cleaning_fee_per_day').val();
city_fee_per_day=jQuery('#city_fee_per_day').val();
security_deposit=jQuery('#security_deposit').val();
property_price_after_label=jQuery('#property_price_after_label').val();
property_price_before_label=jQuery('#property_price_before_label').val();
early_bird_percent=jQuery('#early_bird_percent').val();
early_bird_days=jQuery('#early_bird_days').val();
extra_pay_options=[];
booking_start_hour=jQuery('#booking_start_hour').val();
booking_end_hour=jQuery('#booking_end_hour').val();
$('.extra_pay_option').each(function(){
temp_opt='';
temp_opt=$(this).find('.extra_option_name').val();
temp_opt=temp_opt + '|' + $(this).find('.extra_option_value ').val();
temp_opt=temp_opt + '|' + $(this).find('select').val();
extra_pay_options.push(temp_opt);
});
city_fee_percent=0;
if(jQuery('#city_fee_percent').is(':checked')){
city_fee_percent=1;
}
price_per_guest_from_one=0;
overload_guest=0;
if(jQuery('#price_per_guest_from_one').is(':checked')){
price_per_guest_from_one=1;
}
if(jQuery('#overload_guest').is(':checked')){
overload_guest=1;
}
min_days_booking=jQuery('#min_days_booking').val();
extra_price_per_guest=jQuery('#extra_price_per_guest').val();
price_per_weekeend=jQuery('#price_per_weekeend').val();
checkin_change_over=jQuery('#checkin_change_over').val();
checkin_checkout_change_over=jQuery('#checkin_checkout_change_over').val();
wpestate_scrollToAnchor('all_wrapper');
if(wpestate_check_for_mandatory()){
return;
}
var nonce=jQuery('#wprentals_edit_prop_price_nonce').val();
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
$('#profile_message').empty().append('
' + ajaxcalls_vars.saving + '
');
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_update_listing_price',
'price':price,
'price_week':price_week,
'price_month':price_month,
'listing_edit':listing_edit,
'city_fee':city_fee,
'cleaning_fee':cleaning_fee,
'cleaning_fee_per_day':cleaning_fee_per_day,
'city_fee_per_day':city_fee_per_day,
'min_days_booking':min_days_booking,
'price_per_guest_from_one':price_per_guest_from_one,
'price_per_weekeend':price_per_weekeend,
'checkin_change_over':checkin_change_over,
'checkin_checkout_change_over':checkin_checkout_change_over,
'extra_price_per_guest':extra_price_per_guest,
'overload_guest':overload_guest,
'property_taxes':property_taxes,
'security_deposit':security_deposit,
'property_price_after_label':property_price_after_label,
'property_price_before_label':property_price_before_label,
'early_bird_percent':early_bird_percent,
'early_bird_days':early_bird_days,
'extra_pay_options':extra_pay_options,
'city_fee_percent':city_fee_percent,
'book_type':book_type,
'booking_start_hour':booking_start_hour,
'booking_end_hour':booking_end_hour,
'security':nonce
},
success: function (data){
if(data.edited){
$('#profile_message').empty().append('
' + data.response +'
');
}else{
$('#profile_message').empty().append('
' + data.response + '
');
}
var redirect=jQuery('.next_submit_page').attr('href');
window.location=redirect;
},
error: function (errorThrown){
}});
});
$('#edit_prop_1').on('click',function (){
var ajaxurl, title, category, action_category, guests, city, country, area,listing_edit,prop_desc,property_admin_area,instant_booking,aff_link,private_notes;
title=jQuery('#title').val();
category=jQuery('#prop_category_submit').val();
action_category=jQuery('#prop_action_category_submit').val();
guests=jQuery('#guest_no').val();
city=jQuery('#property_city').val();
aff_link=jQuery('#property_affiliate').val();
if(city===''){
city=jQuery('#property_city_front_autointernal').val();
}
if(ajaxcalls_add_vars.wpestate_autocomplete==='no'){
city=jQuery('#property_city_front_autointernal').val();
}
instant_booking=0;
if(jQuery('#instant_booking').is(':checked')){
instant_booking=1;
}
area=jQuery('#property_area_front').val();
country=jQuery('#property_country').val();
listing_edit=jQuery('#listing_edit').val();
prop_desc=jQuery('#property_description').val();
property_admin_area=jQuery ('#property_admin_area').val();
private_notes=jQuery('#private_notes').val();
ajaxurl=ajaxcalls_add_vars.admin_url + 'admin-ajax.php';
wpestate_scrollToAnchor('all_wrapper');
if(wpestate_check_for_mandatory()){
return;
}
var nonce=jQuery('#wprentals_edit_prop_1_nonce').val();
$('#profile_message').empty().append('
' + ajaxcalls_vars.saving + '
');
$.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_update_listing_description',
'title':title,
'category':category,
'action_category':action_category,
'guests':guests,
'city':city,
'area':area,
'country':country,
'listing_edit':listing_edit,
'prop_desc':prop_desc,
'property_admin_area': property_admin_area,
'instant_booking':instant_booking,
'aff_link':aff_link,
'private_notes':private_notes,
'security':nonce
},
success: function (data){
if(data.edited){
$('#profile_message').empty().append('
' + data.response + '
');
var redirect=jQuery('.next_submit_page').attr('href');
window.location=redirect;
}else{
$('#profile_message').empty().append('
' + data.response + '
');
}},
error: function (errorThrown){
}});
});
});
function wpestate_scrollToAnchor(aid){
var aTag=jQuery("#"+ aid);
jQuery('html,body').animate({scrollTop: aTag.offset().top},'slow');
}
function wpestate_check_for_mandatory(is_check=0){
var reply='';
if(ajaxcalls_add_vars.mandatory_fields.constructor===Array){
ajaxcalls_add_vars.mandatory_fields.forEach(function(field){
var field_orignal=field;
field=field.replace(/%/g, "");
if(jQuery("#"+field).length > 0){
if(jQuery("#"+field).is(':checkbox')&&!jQuery("#"+field).prop('checked')){
reply=wpestate_build_warning(reply,field_orignal);
}
if(jQuery("#"+field).val()===''){
reply=wpestate_build_warning(reply,field_orignal);
}
if(field==="prop_category_submit"||field==="prop_action_category_submit"){
if(jQuery("#"+field).val()==='-1'){
reply=wpestate_build_warning(reply,field_orignal);
}}
if(field=="checkin_change_over"||field=="checkin_checkout_change_over"){
if(jQuery("#"+field).val()==='0'){
reply=wpestate_build_warning(reply,field_orignal);
}}
}});
}
if(reply!==''){
jQuery('#profile_message').empty().append('
'+ajaxcalls_add_vars.pls_fill +': '+ reply + '
');
return true;
}else{
return false;
}}
function wpestate_build_warning(reply,field){
if(reply===''){
reply=reply+ajaxcalls_add_vars.mandatory_fields_label[field];
}else{
reply=reply+', '+ajaxcalls_add_vars.mandatory_fields_label[field];
}
return reply;
};
jQuery(window).scroll(function ($){
"use strict";
var scroll=jQuery(window).scrollTop();
if(scroll >=400){
if(!Modernizr.mq('only all and (max-width: 1180px)')){
jQuery(".property_menu_wrapper_hidden").fadeIn(400);
jQuery(".property_menu_wrapper").fadeOut(400);
}}else{
jQuery(".property_menu_wrapper_hidden").fadeOut(400);
jQuery(".property_menu_wrapper").fadeIn(400);
}});
var who_is=1;
var booking_started=0;
price_array=[];
if(control_vars.custom_price!==''){
price_array=JSON.parse (control_vars.custom_price);
}
booking_array=[];
if(control_vars.booking_array!==''&&control_vars.booking_array.length!==0){
booking_array=JSON.parse (control_vars.booking_array);
}
cleaning_fee_per_day=control_vars.cleaning_fee_per_day;
city_fee_per_day=control_vars.city_fee_per_day;
price_per_guest_from_one=control_vars.price_per_guest_from_one;
checkin_change_over=control_vars.checkin_change_over;
checkin_checkout_change_over=control_vars.checkin_checkout_change_over;
min_days_booking=control_vars.min_days_booking;
extra_price_per_guest=control_vars.extra_price_per_guest;
price_per_weekeend=control_vars.price_per_weekeend;
mega_details=[];
if(control_vars.mega_details!==''){
mega_details=JSON.parse(control_vars.mega_details);
}
weekdays=[];
if(control_vars.weekdays!==''){
weekdays=JSON.parse(control_vars.weekdays);
}
function wprentals_show_booking_calendars(in_date, out_date){
if(property_vars.book_type==='2'){
check_in_out_enable_calendar_per_hour(in_date, out_date);
}else{
check_in_out_enable2(in_date, out_date);
}}
function check_in_out_enable2(in_date, out_date){
var today, prev_date,read_in_date,date_format,calendar_opens;
today=new Date();
date_format=control_vars.date_format.toUpperCase();
today=moment(today).format("MM/DD/YYYY");
minim_days=parseFloat (min_days_booking,10);
calendar_opens='left';
if(jQuery('#primary').hasClass('col-md-pull-8')){
calendar_opens='right';
}
jQuery("#" + in_date).attr('readonly','readonly');
var options={
opens:calendar_opens,
singleDatePicker: false,
autoApply: true,
alwaysShowCalendars: true,
autoUpdateInput: false,
minDate:today,
locale:{
daysOfWeek:dayNamesShort,
monthNames:longmonths
},
isCustomDate:wpestate_booking_show_booked,
};
if(minim_days!==0){
options.minSpan={
"days": minim_days
};}
var date_format=control_vars.date_format.toUpperCase();
date_format=date_format.replace("YY", "YYYY");
var in_date_front=jQuery('#' + in_date);
var out_date_front=jQuery('#' + out_date);
jQuery("#" + out_date).removeAttr('disabled');
var calendar=jQuery("#" + in_date).daterangepicker(options,
function (start, end, label){
start_date=start.format(date_format);
end_date=end.format(date_format);
in_date_front.val(start_date);
out_date_front.val(end_date);
who_is=1;
booking_started=1;
jQuery('.wpestate_calendar').removeClass('minim_days_reservation').removeClass('wpestate_min_days_required');
var prop_id=jQuery('#listing_edit').val();
wpestate_setCookie('booking_prop_id_cookie', prop_id , 1);
wpestate_setCookie('booking_start_date_cookie', jQuery('#start_date').val() , 1);
wpestate_setCookie('booking_end_date_cookie', jQuery('#end_date').val() , 1);
show_booking_costs();
}
);
jQuery("html").on("mouseenter",".wpestate_booking_class", function(){
var unit_class=jQuery(this).attr('class');
unit_class=unit_class.match(/\d+/);
jQuery(this).find('.wpestate_show_price_calendar').show();
if(who_is===1){
wpestate_show_min_days_reservation(unit_class);
}});
jQuery("html").on("mouseleave",".wpestate_booking_class", function(){
jQuery(this).find('.wpestate_show_price_calendar').hide();
wpestate_remove_min_days_reservation(this);
});
}
function wpestate_booking_invalid_Date_new(date){
var display_price='';
var from_who="start_date";
var received_date=new Date(date);
var today=Math.floor(Date.now() / 1000);
var unixtime=received_date.getTime()/1000;
var unixtime1=unixtime - received_date.getTimezoneOffset()*60;
var unixtime1_key=String(unixtime1);
var week_day=received_date.getDay();
var block_check_in_check_out=0;
var block_check_in=0;
if(week_day===0){
week_day=7;
}
if(mega_details[unixtime1_key]!==undefined){
if(parseFloat(mega_details[unixtime1_key]['period_checkin_change_over'],10)!==0){
block_check_in=parseFloat(mega_details[unixtime1_key]['period_checkin_change_over'],10);
}}else if(parseFloat(checkin_change_over)!==0){
block_check_in=parseFloat(checkin_change_over,10);
}
if(mega_details[unixtime1_key]!==undefined){
if(parseFloat(mega_details[unixtime1_key]['period_checkin_checkout_change_over'],10)!==0){
block_check_in_check_out=parseFloat(mega_details[unixtime1_key]['period_checkin_checkout_change_over'],10);
}}else if(parseFloat(checkin_checkout_change_over)!==-1){
block_check_in_check_out=parseFloat(checkin_checkout_change_over,10);
}
start_reservation=1;
if(end_reservation===1){
end_reservation=0;
}
if(week_day!==block_check_in_check_out&&block_check_in_check_out!==0&&unixtime1_key > (today-24*60*60)){
return 'is_block_check_in_check_out';
}else if(week_day!==block_check_in&&block_check_in!==0&&from_who==='start_date'&&unixtime1_key > (today-24*60*60)){
return 'is_block_check_in';
}
return '';
}
function wpestate_booking_show_booked(date){
var display_price='';
var from_who="start_date";
var reservation_class='';
var from_css_class='';
var received_date=new Date(date);
var today=Math.floor(Date.now() / 1000);
var unixtime=received_date.getTime()/1000;
var unixtime1=unixtime - received_date.getTimezoneOffset()*60;
var unixtime1_key=String(unixtime1);
var week_day=received_date.getDay();
var block_check_in_check_out=0;
var block_check_in=0;
if(week_day===0){
week_day=7;
}
if(mega_details[unixtime1_key]!==undefined){
if(parseFloat(mega_details[unixtime1_key]['period_checkin_change_over'],10)!==0){
block_check_in=parseFloat(mega_details[unixtime1_key]['period_checkin_change_over'],10);
}}else if(parseFloat(checkin_change_over)!==0){
block_check_in=parseFloat(checkin_change_over,10);
}
if(mega_details[unixtime1_key]!==undefined){
if(parseFloat(mega_details[unixtime1_key]['period_checkin_checkout_change_over'],10)!==0){
block_check_in_check_out=parseFloat(mega_details[unixtime1_key]['period_checkin_checkout_change_over'],10);
}}else if(parseFloat(checkin_checkout_change_over)!==-1){
block_check_in_check_out=parseFloat(checkin_checkout_change_over,10);
}
var block_class=' disabled off';
if(booking_array[unixtime1]!=undefined){
end_reservation_class=1;
if(start_reservation_class==1){
reservation_class=' start_reservation';
start_reservation_class=0;
return "wpestate_calendar calendar-reserved"+reservation_class+" "+block_class;
}
return "wpestate_calendar calendar-reserved"+reservation_class+" "+block_class;;
}else{
start_reservation_class=1;
if(end_reservation_class===1){
reservation_class=' end_reservation';
end_reservation_class=0;
}
if(week_day!==block_check_in_check_out&&block_check_in_check_out!==0&&unixtime1_key > (today-24*60*60)){
if(reservation_class!==' end_reservation'){
reservation_class=reservation_class+' check_in_block 1';
}
return "wpestate_calendar "+reservation_class+" date"+unixtime1_key;
}else if(week_day!==block_check_in&&block_check_in!==0&&from_who==='start_date'&&unixtime1_key > (today-24*60*60)){
return "wpestate_calendar "+reservation_class+" date"+unixtime1_key;
}
return "freetobook wpestate_calendar"+reservation_class+" date"+unixtime1_key+" "+from_css_class;
}}
function wpestate_show_price_Daterangepicker(date){
"use strict";
var display_price='';
var received_date=new Date(date);
var today=Math.floor(Date.now() / 1000);
var unixtime=received_date.getTime()/1000;
var unixtime1=unixtime - received_date.getTimezoneOffset()*60;
var unixtime1_key=String(unixtime1);
var week_day=received_date.getDay();
if(week_day===0){
week_day=7;
}
if(control_vars.setup_weekend_status==='0'&&(week_day==6||week_day==7)){
display_price=wpestate_return_weekeend_price(week_day,unixtime1_key);
}else if(control_vars.setup_weekend_status==='1'&&(week_day==5||week_day==6)){
display_price=wpestate_return_weekeend_price(week_day,unixtime1_key);
}else if(control_vars.setup_weekend_status==='2'&&(week_day==5||week_day==6||week_day==7)){
display_price=wpestate_return_weekeend_price(week_day,unixtime1_key);
}
return wpestate_booking_calendat_get_price(unixtime1_key,display_price) ;
}
var start_reservation,start_reservation_class,end_reservation,end_reservation_class,reservation_class;
function wpestate_return_weekeend_price(week_day,unixtime1_key){
display_price='';
if(mega_details[unixtime1_key]!==undefined){
if(parseFloat (mega_details[unixtime1_key]['period_price_per_weekeend'],10)!==0){
display_price=parseFloat (mega_details[unixtime1_key]['period_price_per_weekeend'],10);
}}else if(parseFloat(price_per_weekeend,10)!==0){
display_price=parseFloat(price_per_weekeend,10);
}
return display_price;
}
function wpestate_show_min_days_reservation(item){
var step, minim_days ,classad,item_count;
step=0;
minim_days=0;
if(mega_details[item]!=undefined){
minim_days=parseFloat(mega_details[item]['period_min_days_booking'] ,10);
}else if(min_days_booking!=undefined&&min_days_booking>0){
minim_days=parseFloat (min_days_booking,10);
}
classad='date'+item;
item_count=parseFloat(item,10);
if(minim_days>0){
while(step
todate&&todate!==''){
jQuery('#booking_form_request_mess').show().empty().append(property_vars.nostart);
jQuery('#show_cost_form').remove();
return;
}
if(todate=='Invalid date'){
return;
}
var nonce=jQuery('#wprentals_add_booking').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_show_booking_costs',
'fromdate':fromdate,
'todate':todate,
'property_id':property_id,
'guest_no':guest_no,
'guest_fromone':guest_fromone,
'security':nonce
},
success: function (data){
jQuery('#show_cost_form,.cost_row_instant').remove();
jQuery('#add_costs_here').before(data);
wpestate_redo_listing_sidebar();
},
error: function (errorThrown){
}});
}
jQuery(document).ready(function ($){
"use strict";
wpestate_redo_listing_sidebar();
var today, booking_error;
booking_error=0;
today=new Date();
wpestare_booking_retrive_cookies();
if($('#listing_description').outerHeight() > 169){
$('#view_more_desc').show();
}
var sidebar_padding=0;
$('#view_more_desc').on('click',function(event){
var new_margin=0;
if($(this).hasClass('lessismore')){
$(this).text(property_vars.viewmore).removeClass('lessismore');
$('#listing_description .panel-body').removeAttr('style');
$('#listing_description .panel-body').css('max-height','129px');
$('#listing_description .panel-body').css('overflow','hidden');
if(!jQuery('#primary').hasClass('listing_type_1')){
$('#primary').css('margin-top',sidebar_padding);
}}else{
sidebar_padding=$('.listingsidebar').css('margin-top');
$(this).text(property_vars.viewless).addClass('lessismore');
$('#listing_description .panel-body').css('max-height','100%');
$('#listing_description .panel-body').css('overflow','initial');
if(!jQuery('#primary').hasClass('listing_type_1')){
new_margin=$('.property_header').outerHeight() - 390;
new_margin=180-new_margin;
if(new_margin <180){
$('#primary').css('margin-top',new_margin+'px');
}else{
$('#primary').css('margin-top','0px');
}}
}});
$('#listing_main_image_photo').bind('mousemove', function (e){
$('#tooltip-pic').css({'top': e.pageY, 'left': e.pageX, 'z-index': '1'});
});
setTimeout(function (){
$('#tooltip-pic').fadeOut("fast");
}, 10000);
wprentals_show_booking_calendars('start_date', 'end_date');
wprentals_show_static_calendar();
$('#end_date').change(function (){
var prop_id=jQuery('#listing_edit').val();
wpestate_setCookie('booking_prop_id_cookie', prop_id , 1);
wpestate_setCookie('booking_end_date_cookie', $('#end_date').val() , 1);
booking_started=1;
show_booking_costs();
});
$('#start_date').change(function (){
var prop_id=jQuery('#listing_edit').val();
wpestate_setCookie('booking_prop_id_cookie', prop_id , 1);
wpestate_setCookie('booking_start_date_cookie', $('#start_date').val() , 1);
if(booking_started===1){
show_booking_costs();
}});
$('#booking_guest_no_wrapper_list li').on('click',function (){
var prop_id=jQuery('#listing_edit').val();
wpestate_setCookie('booking_prop_id_cookie', prop_id , 1);
var booking_guest_no=parseInt(jQuery('#booking_guest_no_wrapper').attr('data-value'));
wpestate_setCookie('booking_guest_cookie', booking_guest_no , 1);
if(booking_started===1){
show_booking_costs();
}});
function wpestare_booking_retrive_cookies(){
var booking_guest_cookie=wpestate_getCookie("booking_guest_cookie");
var booking_start_date_cookie=wpestate_getCookie("booking_start_date_cookie");
var booking_end_date_cookie=wpestate_getCookie("booking_end_date_cookie");
var booking_prop_id=wpestate_getCookie("booking_prop_id_cookie");
var prop_id=jQuery('#listing_edit').val();
if(prop_id===booking_prop_id&&property_vars.logged_in==="yes"){
if(booking_start_date_cookie!==''){
jQuery('#start_date').val(booking_start_date_cookie);
}
if(booking_end_date_cookie!==''){
jQuery('#end_date').val(booking_end_date_cookie);
}
if(booking_guest_cookie!==''){
jQuery('#booking_guest_no_wrapper').attr('data-value',booking_guest_cookie);
jQuery('#booking_guest_no_wrapper .text_selection').html(booking_guest_cookie+' '+property_vars.guests);
}
if(booking_start_date_cookie!==''&&booking_end_date_cookie!==''&&booking_guest_cookie!==''){
booking_started=1;
show_booking_costs();
}}
}
$('#booking_form_request li').on('click',function (event){
event.preventDefault();
var guest_fromone, guest_overload;
guest_overload=parseInt(jQuery('#submit_booking_front').attr('data-overload'),10);
guest_fromone=parseInt(jQuery('#submit_booking_front').attr('data-guestfromone'),10);
if(document.getElementById('submit_booking_front_instant')){
guest_overload=parseInt(jQuery('#submit_booking_front_instant').attr('data-overload'),10);
guest_fromone=parseInt(jQuery('#submit_booking_front_instant').attr('data-guestfromone'),10);
}
if(( guest_overload===1&&booking_started===1)||guest_fromone===1){
show_booking_costs();
}});
function wpestate_show_contact_owner_form(booking_id, agent_id){
var ajaxurl;
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
jQuery('#contact_owner_modal').modal();
enable_actions_modal_contact();
}
$('#contact_host,#contact_me_long,.contact_owner_reservation').on('click',function (){
var booking_id, agent_id,property_id;
agent_id=0;
booking_id=$(this).attr('data-postid');
property_id=$(this).attr('data-bookid');
$('#submit_mess_front').attr('data-property_id',property_id);
wpestate_show_contact_owner_form(booking_id, agent_id);
});
$('#contact_me_long_owner').on('click',function (){
var agent_id, booking_id;
booking_id=0;
agent_id=$(this).attr('data-postid');
wpestate_show_contact_owner_form(booking_id, agent_id);
});
function enable_actions_modal_contact(){
jQuery('#contact_owner_modal').on('hidden.bs.modal', function (e){
jQuery('#contact_owner_modal').hide();
});
var today=new Date().getTime();
$("#booking_from_date").change(function (){
var prev_date=new Date($('#booking_from_date').val());
var read_in_date=$("#booking_from_date").val();
prev_date=wpestate_convert_selected_days_simple_add_days(read_in_date,1);
jQuery("#booking_to_date").datepicker("destroy");
jQuery("#booking_to_date").datepicker({
minDate: prev_date
}, jQuery.datepicker.regional[control_vars.datepick_lang]);
});
$('#submit_mess_front').on('click',function (event){
event.preventDefault();
var ajaxurl, subject, booking_from_date, booking_to_date, booking_guest_no, message, nonce, agent_property_id, agent_id;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
booking_from_date=$("#booking_from_date").val();
booking_to_date=$("#booking_to_date").val();
booking_guest_no=$("#booking_guest_no").val();
message=$("#booking_mes_mess").val();
agent_property_id=$("#agent_property_id").val();
agent_id=$('#agent_id').val();
nonce=$("#security-register-mess-front").val();
var contact_u_email=$("#contact_u_email").val();
var contact_u_name=$("#contact_u_name").val();
if(subject===''||message===''){
$("#booking_form_request_mess_modal").empty().append(property_vars.plsfill);
return;
}
if(property_vars.logged_in!=="yes"&&(contact_u_email===''||contact_u_name==='')){
$("#booking_form_request_mess_modal").empty().append(property_vars.plsfill);
return;
}
if(agent_property_id==0&&jQuery('.contact_owner_reservation').length>0){
agent_property_id=$(this).attr('data-property_id');
agent_id=0;
}
var nonce=jQuery('#wprentals_submit_mess_front_nonce').val();
if(property_vars.use_gdpr==='yes'){
if(!$('#wpestate_agree_gdpr').is(':checked')){
$("#booking_form_request_mess_modal").empty().append(property_vars.gdpr_terms);
return;
}}
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_mess_front_end',
'message':message,
'booking_guest_no':booking_guest_no,
'booking_from_date':booking_from_date,
'booking_to_date':booking_to_date,
'agent_property_id':agent_property_id,
'agent_id':agent_id,
'contact_u_email':contact_u_email,
'contact_u_name':contact_u_name,
'security':nonce
},
success: function (data){
$("#booking_form_request_mess_modal").empty().append(data);
setTimeout(function (){
$('#contact_owner_modal').modal('hide');
$("#booking_form_request_mess_modal").empty();
$("#contact_u_email").val('');
$("#contact_u_name").val('');
$("#booking_from_date").val('');
$("#booking_to_date").val('');
$("#booking_guest_no").val('1');
$("#booking_mes_mess").val('');
$('#submit_mess_front').unbind('click');
}, 2000);
},
error: function (errorThrown){
}});
});
}
$('.cost_row_extra input').on('click',function(){
var key_to_add,row_to_add,total_value,value_to_add,value_how,value_name,parent,fromdate,todate,listing_edit,booking_guest_no,cost_value_show;
parent=$(this).parent().parent();
value_to_add=parseFloat(parent.attr('data-value_add'));
value_to_add=parseFloat(wpestate_booking_form_currency_convert(value_to_add));
value_how=parseFloat(parent.attr('data-value_how'));
value_name=parent.attr('data-value_name');
key_to_add=jQuery(this).attr('data-key');
fromdate=wpestate_convert_selected_days(jQuery("#start_date").val());
todate=wpestate_convert_selected_days(jQuery("#end_date").val());
listing_edit=jQuery('#listing_edit').val();
booking_guest_no=parseInt(jQuery('#booking_guest_no_wrapper').attr('data-value'));
cost_value_show=parent.find('.cost_value_show').text();
var firstDate=new Date(fromdate);
var secondDate=new Date(todate);
var oneDay=24*60*60*1000;
if(property_vars.book_type==='2'){
oneDay=60*60*1000;
}
var diffDays=Math.round(Math.abs((firstDate.getTime() - secondDate.getTime())/(oneDay)));
var total_curent=parseFloat($('#total_cost_row .cost_value').attr('data_total_price'));
total_curent=parseFloat(wpestate_booking_form_currency_convert(total_curent));
if(booking_guest_no===0||isNaN(booking_guest_no)){
booking_guest_no=1;
}
if(($(this).is(":checked"))){
if(value_how===0){
total_value=value_to_add;
}else if(value_how===1){
total_value=value_to_add * diffDays;
}else if(value_how===2){
total_value=value_to_add * booking_guest_no;
}else if(value_how===3){
total_value=value_to_add * diffDays*booking_guest_no;
}
row_to_add=''+value_name+'
'+estate_format_number_with_currency(total_value.toFixed(2))+'
';
$('#total_cost_row').before(row_to_add);
var new_early_bird_before_convert;
var new_early_bird=parseFloat($('#early_bird_discount').attr('data-early-bird'));
new_early_bird=parseFloat(wpestate_booking_form_currency_convert(new_early_bird));
if(isNaN(new_early_bird)||new_early_bird===0){
new_early_bird=0;
}
new_early_bird.toFixed(2);
total_curent=total_curent + new_early_bird;
total_curent=total_curent + total_value;
if(new_early_bird!==0){
new_early_bird=new_early_bird + total_value * property_vars.early_discount/100;
var new_early_bird_before_convert=wpestate_booking_form_currency_convert_back(new_early_bird);
new_early_bird.toFixed(2);
}
total_curent=total_curent - new_early_bird;
total_curent=total_curent.toFixed(2);
var total_curent_deposit=total_curent;
if(control_vars.include_expeses==='no'){
var cleaning_fee=parseFloat($('.cleaning_fee_value').attr('data_cleaning_fee'));
cleaning_fee.toFixed(2);
var city_fee=parseFloat($('.city_fee_value').attr('data_city_fee'));
city_fee.toFixed(2);
if(isNaN(city_fee)){
city_fee=0;
}
if(isNaN(cleaning_fee)){
cleaning_fee=0;
}
total_curent_deposit=total_curent_deposit-cleaning_fee-city_fee;
total_curent_deposit.toFixed(2);
}
$('#total_cost_row .cost_value').text(estate_format_number_with_currency(total_curent));
var total_curent_before_convert=wpestate_booking_form_currency_convert_back(total_curent);
$('#total_cost_row .cost_value').attr('data_total_price',total_curent_before_convert);
var new_depozit=wpestate_instant_book_depozit(total_curent_deposit);
var new_balance=total_curent-new_depozit;
$('.instant_depozit_value').text(estate_format_number_with_currency(new_depozit.toFixed(2)));
$('.instant_balance_value').text(estate_format_number_with_currency(new_balance.toFixed(2)));
$('#early_bird_discount').text(estate_format_number_with_currency(new_early_bird.toFixed(2)));
$('#early_bird_discount').attr('data-early-bird',new_early_bird_before_convert);
}else{
value_name=estate_makeSafeForCSS(value_name);
var remove_row_value=parseFloat($('#'+value_name).attr('data-added'));
$('#'+value_name).remove();
var new_early_bird=parseFloat($('#early_bird_discount').attr('data-early-bird'));
if(isNaN(new_early_bird)||new_early_bird===0){
new_early_bird=0;
}
var new_early_bird_before_convert=wpestate_booking_form_currency_convert(new_early_bird);
new_early_bird.toFixed(2);
total_curent=total_curent + new_early_bird_before_convert;
total_curent=total_curent - remove_row_value;
if(new_early_bird!==0){
new_early_bird=new_early_bird_before_convert - remove_row_value * property_vars.early_discount/100;
new_early_bird_before_convert=wpestate_booking_form_currency_convert_back(new_early_bird);
new_early_bird.toFixed(2);
}
total_curent=total_curent - new_early_bird;
total_curent=total_curent.toFixed(2);
var total_curent_deposit=total_curent;
if(control_vars.include_expeses==='no'){
var cleaning_fee=parseFloat($('.cleaning_fee_value').attr('data_cleaning_fee'));
cleaning_fee=isNaN(cleaning_fee) ? 0:cleaning_fee;
var city_fee=parseFloat($('.city_fee_value').attr('data_city_fee'));
city_fee=isNaN(city_fee) ? 0:city_fee;
total_curent_deposit=total_curent_deposit-cleaning_fee-city_fee;
total_curent_deposit.toFixed(2);
}
$('#total_cost_row .cost_value').text(estate_format_number_with_currency (total_curent));
var total_curent_before_convert=wpestate_booking_form_currency_convert_back(total_curent);
$('#total_cost_row .cost_value').attr('data_total_price',total_curent_before_convert);
var new_depozit=wpestate_instant_book_depozit(total_curent_deposit);
var new_balance=total_curent-new_depozit;
$('.instant_depozit_value').text(estate_format_number_with_currency(new_depozit));
$('.instant_balance_value').text(estate_format_number_with_currency(new_balance));
$('#early_bird_discount').text(estate_format_number_with_currency(new_early_bird));
$('#early_bird_discount').attr('data-early-bird',new_early_bird_before_convert);
}
wpestate_redo_listing_sidebar();
});
function wpestate_instant_book_depozit(total_price){
var deposit=0;
if(control_vars.wp_estate_book_down_fixed_fee==='0'){
if(control_vars.wp_estate_book_down===''||control_vars.wp_estate_book_down==='0'){
deposit=0;
}else{
deposit=control_vars.wp_estate_book_down*total_price/100;
}}else{
deposit=control_vars.wp_estate_book_down_fixed_fee;
}
return deposit;
}
function wpestate_booking_form_currency_convert(display_price){
var return_price;
return_price='';
if(!isNaN(my_custom_curr_pos)&&my_custom_curr_pos!==-1){
return_price=(display_price * my_custom_curr_coef) ;
return return_price;
}else{
return display_price;
}}
function wpestate_booking_form_currency_convert_back(display_price){
var return_price;
return_price='';
if(!isNaN(my_custom_curr_pos)&&my_custom_curr_pos!==-1){
return_price=(display_price / my_custom_curr_coef) ;
return return_price;
}else{
return display_price;
}}
$('#submit_booking_front,#submit_booking_front_instant').on('click',function (event){
event.preventDefault();
var scroll_val=$('#booking_form_request').offset().top -100;
$("html, body").animate({ scrollTop: scroll_val}, 400);
if(property_vars.logged_in==="no"){
$('#booking_form_request_mess').show().empty().addClass('book_not_available').append(property_vars.notlog);
}
var guest_number, guest_overload,guestfromone,max_guest;
if(!check_booking_form()||booking_error===1){
return;
}
guest_number=1;
guest_number=parseInt(guest_number,10);
if(isNaN(guest_number)){
guest_number=0;
}
if(property_vars.rental_type==='1'){
guest_number=1;
}
max_guest=parseInt (jQuery('#submit_booking_front').attr('data-maxguest'),10);
guest_overload=parseInt (jQuery('#submit_booking_front').attr('data-overload'),10);
guestfromone=parseInt (jQuery('#submit_booking_front').attr('data-guestfromone'),10);
if(document.getElementById('submit_booking_front_instant')){
max_guest=parseInt (jQuery('#submit_booking_front_instant').attr('data-maxguest'),10);
guest_overload=parseInt (jQuery('#submit_booking_front_instant').attr('data-overload'),10);
guestfromone=parseInt (jQuery('#submit_booking_front_instant').attr('data-guestfromone'),10);
}
if(guestfromone===1&&guest_number < 1){
$('#booking_form_request_mess').show().empty().addClass('book_not_available').append(property_vars.noguest);
return;
}
if(guest_number < 1){
$('#booking_form_request_mess').show().empty().addClass('book_not_available').append(property_vars.noguest);
return;
}
if(guest_overload===0&&guest_number>max_guest){
$('#booking_form_request_mess').show().empty().addClass('book_not_available').append(property_vars.guestoverload+max_guest+' '+property_vars.guests);
return;
}
var is_woo=0;
if(jQuery('#submit_booking_front_instant').length>0&&property_vars.is_woo==='yes'){
is_woo=1;
}
if(property_vars.logged_in==="no"&&is_woo===0){
$('#booking_form_request_mess').show().empty().addClass('book_not_available').append(property_vars.notlog);
login_modal_type=3;
wpestate_show_login_form(1, 9, 0);
}else{
$('#booking_form_request_mess').show().empty().removeClass('book_not_available').append(property_vars.sending);
wpestate_redo_listing_sidebar();
wprentals_check_booking_valability();
}});
function check_booking_form(){
var book_from, book_to;
book_from=$("#start_date").val();
book_to=$("#end_date").val();
if(book_from===''||book_to===''){
$('#booking_form_request_mess').empty().addClass('book_not_available').show().append(property_vars.plsfill);
return false;
}else{
return true;
}}
});
function estate_format_number_with_currency(number){
if(!isNaN(my_custom_curr_pos)&&my_custom_curr_pos!==-1){
if(my_custom_curr_cur_post==='before'){
return(my_custom_curr_symbol2) +" "+number;
}else{
return number+" "+(my_custom_curr_symbol2);
}}else{
if(control_vars.where_curency==='before'){
return control_vars.curency+" "+number;
}else{
return number+" "+control_vars.curency;
}}
}
function estate_makeSafeForCSS(name){
return name.replace(/[^a-z0-9]/g, function(s){
var c=s.charCodeAt(0);
if(c==32) return '-';
if(c >=65&&c <=90) return '_' + s.toLowerCase();
return '__' + ('000' + c.toString(16)).slice(-4);
});
}
function wpestate_setCookie(cname, cvalue, exdays){
var d=new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires="expires="+ d.toUTCString();
document.cookie=cname + "=" + cvalue + ";" + expires + ";path=/";
}
function wpestate_getCookie(cname){
var name=cname + "=";
var decodedCookie=decodeURIComponent(document.cookie);
var ca=decodedCookie.split(';');
for(var i=0; i 0){
var today=new Date();
var start_temp='';
var listing_book_dates=[];
for (var key in booking_array){
if(booking_array.hasOwnProperty(key)&&key!==''){
var temp_book=[];
temp_book['title']=property_vars.reserved;
temp_book ['start']=moment.unix(key).utc().format();
temp_book ['end']=moment.unix(booking_array[key]).utc().format();
temp_book ['editable']=false;
listing_book_dates.push(temp_book);
}}
jQuery("#all-front-calendars_per_hour").fullCalendar({
defaultView: 'agendaWeek',
navLinks: false,
defaultDate: today,
selectable:false,
selectHelper:true,
selectOverlap :false,
footer:false,
slotDuration:'01:00:00',
allDayText:'часы',
weekNumbers: false,
weekNumbersWithinDays: true,
weekNumberCalculation: 'ISO',
editable: false,
eventLimit: true,
unselectAuto:false,
isRTL:control_vars.rtl_book_hours_calendar,
header: {
left: 'prev,next today',
center: 'title',
right: ''
},
minTime:control_vars.booking_start_hour,
maxTime:control_vars.booking_end_hour,
events: listing_book_dates
});
}}
function check_in_out_enable_calendar_per_hour(in_date, out_date){
"use strict";
jQuery("#" + out_date).removeAttr('disabled');
jQuery("#" + in_date).on('click',function(){
jQuery('#book_per_hour_wrapper').show();
wprentals_show_Calendar(in_date, out_date);
jQuery('#book_per_hour_calendar').fullCalendar('render');
});
jQuery("#" + out_date).on('click',function(){
jQuery('#book_per_hour_wrapper').show();
wprentals_show_Calendar(in_date, out_date);
jQuery('#book_per_hour_calendar').fullCalendar('render');
});
jQuery('#book_per_hour_close').on('click',function(){
jQuery('#book_per_hour_wrapper').hide();
});
jQuery('#per_hour_ok').on('click',function(){
jQuery('#book_per_hour_wrapper').hide();
show_booking_costs();
});
jQuery('#per_hour_cancel').on('click',function(){
jQuery('#book_per_hour_wrapper').hide();
jQuery("#" + in_date).val('');
jQuery("#" + out_date).val('');
});
var today, prev_date,read_in_date;
jQuery("#" + in_date+',#'+out_date).blur();
}
window.wprentals_mobilecheck=function(){
var check=false;
(function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm(os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s)|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp(i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac(|\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt(|\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg(g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v)|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v)|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-|)|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check=true;})(navigator.userAgent||navigator.vendor||window.opera);
return check;
};
function wprentals_show_Calendar(in_date,out_date){
var today=new Date();
var start_temp='';
var listing_book_dates=[];
for (var key in booking_array){
if(booking_array.hasOwnProperty(key)&&key!==''){
var temp_book=[];
temp_book['title']=property_vars.reserved;
temp_book ['start']=moment.unix(key).utc().format(),
temp_book ['end']=moment.unix(booking_array[key]).utc().format(),
temp_book ['editable']=false;
listing_book_dates.push(temp_book);
}}
jQuery("#book_per_hour_calendar").fullCalendar({
defaultView: 'agendaWeek',
defaultDate: today,
selectable:true,
selectHelper:true,
selectOverlap :false,
footer:false,
slotDuration:'01:00:00',
validRange: {
start: today,
end: '2025-06-01'
},
allDayText:'часы',
allDay :false,
forceEventDuration:true,
defaultTimedEventDuration:'05:00:00',
navLinks: false,
weekNumbers: false,
weekNumbersWithinDays: false,
weekNumberCalculation: 'ISO',
editable: true,
eventLimit: true,
unselectAuto:false,
nowIndicator :true,
defaultEventMinutes :200,
isRTL:control_vars.rtl_book_hours_calendar,
longPressDelay :100,
eventLongPressDelay:100,
selectLongPressDelay:100,
header: {
left: 'prev,next today',
center: 'title',
right: ''
},
minTime:control_vars.booking_start_hour,
maxTime:control_vars.booking_end_hour,
dayRender:function(date, cell){
if(date.isSame(today, "day")){
cell.attr("xday", "meday");
}},
dayClick: function(date, jsEvent, view){
},
select:function(start, end, jsEvent, view){
end=moment(end);
var min_hours=parseFloat(control_vars.min_days_booking);
var start_of_day=(moment(start).startOf('day'))/1000;
if(mega_details[start_of_day]!==undefined){
min_hours=mega_details[start_of_day]['period_min_days_booking'];
}
var should_end=moment(start).add(min_hours, 'hours');
if(should_end>end){
end=should_end;
}
jQuery('#book_per_hour_calendar').fullCalendar('unselect');
jQuery('#book_per_hour_calendar').fullCalendar('removeEvents','rentals_custom_book_initial');
jQuery('#book_per_hour_calendar').fullCalendar('renderEvent',{
id:'rentals_custom_book_initial',
start: start,
end: end,
allDay: false,
editable:false,
},
true
);
jQuery('#book_per_hour_calendar').fullCalendar('removeEvents','rentals_custom_book');
var date_format=control_vars.date_format.toUpperCase()+" HH:mm";
var new_date_format=date_format.replace("YY", "YYYY");
jQuery("#" + in_date).val(start.format(new_date_format));
jQuery("#" + out_date).val(end.format(new_date_format));
jQuery('.fc-center .hour_selection').empty().html(start.format(new_date_format)+' до '+end.format(new_date_format));
var prop_id=jQuery('#listing_edit').val();
wpestate_setCookie('booking_prop_id_cookie', prop_id , 1);
wpestate_setCookie('booking_start_date_cookie', start.format(new_date_format) , 1);
wpestate_setCookie('booking_end_date_cookie', end.format(new_date_format) , 1);
booking_started=1;
},
events: listing_book_dates
});
jQuery('.fc-center .hour_selection').remove();
jQuery('#book_per_hour .fc-center').append('нажмите и перетащите, чтобы выбрать часы
');
};
window.addComment=function(s){var u,f,v,y=s.document,p={commentReplyClass:"comment-reply-link",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=s.MutationObserver||s.WebKitMutationObserver||s.MozMutationObserver,i="querySelector"in y&&"addEventListener"in s,n=!!y.documentElement.dataset;function t(){r(),function(){if(!e)return;new e(d).observe(y.body,{childList:!0,subtree:!0})}()}function r(e){if(i&&(u=I(p.cancelReplyId),f=I(p.commentFormId),u)){u.addEventListener("touchstart",a),u.addEventListener("click",a);var t=function(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode)return f.removeEventListener("keydown",t),e.preventDefault(),f.submit.click(),!1};f&&f.addEventListener("keydown",t);for(var n,r=function(e){var t,n=p.commentReplyClass;e&&e.childNodes||(e=y);t=y.getElementsByClassName?e.getElementsByClassName(n):e.querySelectorAll("."+n);return t}(e),d=0,o=r.length;d \n\
';
$('#custom_detail_value').val('');
$('#custom_detail_label').val('');
$('#extra_details_list').append(to_add);
}});
jQuery('#add_extra_feed').on('click',function(event){
var to_add,feed_label,feed_url;
feed_label=$('#property_icalendar_import_name_new').val();
feed_url=$('#property_icalendar_import_feed_new').val();
if(feed_url!==''){
to_add='
';
$('#property_icalendar_import_name_new').val('');
$('#property_icalendar_import_feed_new').val('');
$('#icalfeed_wrapper').append(to_add);
}});
jQuery('.delete_extra_option').on('click',function(event){
jQuery(this).parent().remove();
});
jQuery('#add_extra_option').on('click',function(event){
var option_name,option_value,option_type,to_add,select_name;
$('.no_extra_pay_option').remove();
option_name=$('#add_option_name').val();
option_value=$('#add_option_value').val();
option_type=$('#add_option_type').val();
select_name=option_name+"_select";
to_add='';
$('#add_option_name').val('');
$('#add_option_value').val('');
$('.extra_pay_option_wrapper').append(to_add);
});
function wpestate_generate_type_dropdown(type){
var type_free, type_per_night, type_per_guest, type_per_night_guest;
type_free='';
type_per_night='';
type_per_guest='';
type_per_night_guest='';
type=parseInt(type);
if(type===0){
type_free=' selected ';
}else if(type===1){
type_per_night=' selected ';
}else if(type===2){
type_per_guest=' selected ';
}else if(type===3){
type_per_night_guest=' selected ';
}
return '
'+dashboard_vars.single_fee+' '+dashboard_vars.per_hdnight+' '+dashboard_vars.per_guest+' Per H/Day/Night per Guest '
}
jQuery('.activate_payments').on('click',function(event){
jQuery(this).parent().parent().find('.listing_submit').show();
});
jQuery('.close_payments').on('click',function(event){
jQuery(this).parent().hide();
});
jQuery("#invoice_start_date").datepicker({
}, jQuery.datepicker.regional[control_vars.datepick_lang]).datepicker('widget').wrap('
');
jQuery("#invoice_end_date").datepicker({
}, jQuery.datepicker.regional[control_vars.datepick_lang]).datepicker('widget').wrap('
');
$('#invoice_start_date, #invoice_end_date, #invoice_type ,#invoice_status ').change(function(){
filter_invoices();
});
$('.mess_send_reply_button').on('click',function (){
var messid, ajaxurl, acesta, parent, title, content, container, mesage_container;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
parent=$(this).parent().parent();
mesage_container=parent.find('.mess_content');
container=$(this).parent();
messid=parent.attr('data-messid');
acesta=$(this);
title=parent.find('.subject_reply').val();
content=parent.find('.message_reply_content').val();
var reply_to_id=$(this).attr('data-mess-reply_to_id');
var nonce=jQuery('#wprentals_inbox_actions').val();
parent.find('.mess_unread').remove();
acesta.text(dashboard_vars.sending);
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_message_reply',
'messid':messid,
'title':title,
'content':content,
'reply_to_id':reply_to_id,
'security':nonce,
},
success: function (data){
$('.message_reply_content').val('');
acesta.text(dashboard_vars.send_reply);
mesage_container.hide();
container.hide();
},
error: function (errorThrown){
}});
});
$('.message_header').on('click',function (){
var messid, ajaxurl, acesta, parent;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
parent=$(this).parent();
messid=parent.attr('data-messid');
acesta=$(this);
var replies_to_mark=parent.find('.mess_reply_form').attr('data-unread_replies');
replies_to_mark=parseInt(replies_to_mark,10);
var nonce=jQuery('#wprentals_inbox_actions').val();
$('.mess_content, .mess_reply_form').hide();
$(this).parent().find('.mess_content, .mess_reply_form').show();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_booking_mark_as_read',
'messid':messid,
'replies_to_mark':replies_to_mark,
'security':nonce,
},
success: function (data){
if(parent.find('.mess_unread').length>0){
parent.find('.mess_unread').remove();
wpestate_update_mess_no(replies_to_mark);
}},
error: function (errorThrown){
}});
});
$('.mess_reply').on('click',function (event){
return;
var messid, ajaxurl, acesta, parent;
event.stopPropagation();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
parent=$(this).parent().parent().parent();
messid=parent.attr('data-messid');
acesta=$(this);
$('.mess_content, .mess_reply_form').hide();
parent.find('.mess_content').show();
parent.find('.mess_reply_form').show();
var replies_to_mark=parent.find('.mess_reply_form').attr('data-unread_replies');
replies_to_mark=parseInt(replies_to_mark,10);
var nonce=jQuery('#wprentals_inbox_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_booking_mark_as_read',
'messid':messid,
'replies_to_mark':replies_to_mark,
'security':nonce
},
success: function (data){
if(parent.find('.mess_unread').length>0){
parent.find('.mess_unread').remove();
wpestate_update_mess_no(replies_to_mark);
}},
error: function (errorThrown){
}});
});
$('.mess_delete').on('click',function (event){
if(confirm(dashboard_vars.delete_mess)){
var messid, ajaxurl, acesta, parent;
event.stopPropagation();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
parent=$(this).parent().parent().parent().parent();
messid=parent.attr('data-messid');
acesta=$(this);
$(this).parent().parent().empty().addClass('delete_inaction').html(dashboard_vars.deleting);
var nonce=jQuery('#wprentals_inbox_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_booking_delete_mess',
'messid':messid,
'security':nonce
},
success: function (data){
parent.parent().remove();
$('.mess_content, .mess_reply_form').hide();
if(parent.find('.mess_unread').length>0){
parent.find('.mess_unread').remove();
wpestate_update_mess_no(1);
}},
error: function (errorThrown){
}});
}});
function wpestate_update_mess_no(value){
var mess_no=parseInt(jQuery('.user_dashboard_links .unread_mess_wrap_menu').text(),10);
var new_mess_no=mess_no-value;
if(new_mess_no<0){
new_mess_no=0;
}
jQuery('#unread_mess_wrap_no').text(new_mess_no);
jQuery('.unread_mess_wrap_menu').text(new_mess_no);
}
$('.post_review').on('click',function (){
var listing_id, ajaxurl, acesta, parent,bookid;
listing_id=$(this).attr('data-listing-review');
bookid=$(this).attr('data-bookid');
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
acesta=$(this);
parent=$(this).parent().parent();
var nonce=jQuery('#wprentals_reservation_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_show_review_form',
'listing_id':listing_id,
'bookid':bookid,
'security':nonce
},
success: function (data){
jQuery('.create_invoice_form').remove();
parent.after(data);
wpestate_create_review_action();
},
error: function (errorThrown){
}});
});
function wpestate_enable_star_action(){
jQuery(".empty_star").on("hover", function(event){
if(event.type==="mouseenter"){
var loop, index;
index=jQuery(this).parent().find('.empty_star').index(this);
jQuery(this).parent().find('.empty_star').each(function (){
loop=jQuery(this).parent().find('.empty_star').index(this);
if(loop <=index){
jQuery(this).addClass('starselected');
}else{
jQuery(this).removeClass('starselected');
}});
}else if(event.type==="mouseleave"){
}});
}
function wpestate_create_review_action(){
wpestate_enable_star_action();
jQuery('#post_review').on('click',function (){
var listing_id=jQuery(this).attr('data-listing_id'),
bookid=jQuery(this).attr('data-bookid'),
content=jQuery(this).parent().find('#review_content').val(),
starsCont=jQuery(this).parent().find('.starselected').parent(),
ajaxurl=control_vars.admin_url + 'admin-ajax.php',
acesta=jQuery(this),
parent=jQuery(this).parent().parent(),
starsTotal=0,
stars='{';
starsCont.each(function(index){
var starsThis=parseInt(jQuery(this).find('.starselected').length);
starsTotal=starsTotal + starsThis;
stars +=('"' + jQuery(this).attr('class') + '": ' + starsThis + ',');
});
stars +=('"rating": ' +(Math.round(( starsTotal / starsCont.length) * 2) / 2).toFixed(1));
stars +='}';
jQuery(this).text(dashboard_vars.sending);
var nonce=jQuery('#wprentals_reservation_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_post_review',
'listing_id':listing_id,
'bookid':bookid,
'stars':stars,
'content':content,
'security':nonce
},
success: function (data){
jQuery('.create_invoice_form').remove();
jQuery('.post_review').remove();
},
error: function (errorThrown){
}});
});
}
$('.full_invoice_reminder').on('click',function (){
var invoice_id, booking_id, ajaxurl, acesta, parent;
booking_id=$(this).attr('data-bookid');
invoice_id=$(this).attr('data-invoiceid');
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
acesta=$(this);
parent=$(this).parent().parent();
$(this).text(dashboard_vars.sending);
$(this).unbind('click');
acesta=$(this);
var nonce=jQuery('#wprentals_bookings_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_send_full_pay_reminder',
'invoice_id':invoice_id,
'booking_id':booking_id,
'security':nonce,
},
success: function (data){
acesta.text(dashboard_vars.sent);
},
error: function (errorThrown){
}});
});
$('.confirmed_booking').on('click',function (){
var invoice_id, booking_id, ajaxurl, acesta, parent;
booking_id=$(this).attr('data-booking-confirmed');
invoice_id=$(this).attr('data-invoice-confirmed');
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
acesta=$(this);
parent=$(this).parent().parent();
var nonce=jQuery('#wprentals_booking_confirmed_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_show_confirmed_booking',
'invoice_id':invoice_id,
'booking_id':booking_id,
'security':nonce
},
success: function (data){
jQuery('.create_invoice_form').remove();
parent.after(data);
wpestate_create_payment_action();
create_print_action();
},
error: function (errorThrown){
}});
});
wpestate_enable_invoice_actions();
$('.proceed-payment,.proceed-payment_full').on('click',function (){
var is_full,invoice_id, booking_id, ajaxurl, acesta, parent;
invoice_id=$(this).attr('data-invoiceid');
booking_id=$(this).attr('data-bookid');
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
acesta=$(this);
parent=$(this).parent().parent();
is_full=0;
if($(this).hasClass('proceed-payment_full')){
is_full=1;
}
var nonce=jQuery('#wprentals_reservation_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_create_pay_user_invoice_form',
'booking_id':booking_id,
'invoice_id':invoice_id,
'is_full':is_full,
'security':nonce,
},
success: function (data){
jQuery('.create_invoice_form').remove();
parent.after(data);
wpestate_create_payment_action();
create_print_action();
},
error: function (errorThrown){
}});
});
$('.delete_booking').on('click',function (){
var booking_id, ajaxurl, acesta, isuser;
booking_id=$(this).attr('data-bookid');
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
acesta=$(this);
isuser=0;
if($(this).hasClass('usercancel')){
isuser=1;
}
$(this).empty().html(dashboard_vars.deleting);
$('.create_invoice_form').remove();
var nonce=jQuery('#wprentals_booking_confirmed_actions').val();
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_delete_booking_request',
'booking_id':booking_id,
'isuser':isuser,
'security':nonce
},
success: function (data){
acesta.parent().parent().remove();
},
error: function (errorThrown){
}});
});
$('.cancel_own_booking, .cancel_user_booking').on('click',function (){
var booking_id, ajaxurl, acesta, listing_id;
booking_id=$(this).attr('data-booking-confirmed');
listing_id=$(this).attr('data-listing-id');
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
acesta=$(this);
$(this).empty().html(dashboard_vars.deleting);
$(".create_invoice_form").hide();
var nonce=jQuery('#wprentals_booking_confirmed_actions').val();
$.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_cancel_own_booking',
'booking_id':booking_id,
'listing_id':listing_id,
'security':nonce
},
success: function (data){
acesta.parent().parent().remove();
},
error: function (errorThrown){
}});
});
});
function wpestate_create_generate_invoice_action(){
jQuery('.generate_invoice').on('click',function (){
var parent, ajaxurl, bookid, acesta;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
parent=jQuery(this).parent().parent();
bookid=jQuery(this).attr('data-bookid');
acesta=jQuery(this);
var nonce=jQuery('#wprentals_bookings_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_create_invoice_form',
'bookid':bookid,
'security':nonce,
},
success: function (data){
jQuery('.create_invoice_form').remove();
parent.after(data);
wpestate_invoice_create_js();
},
error: function (errorThrown){
}});
});
}
function wpestate_create_delete_invoice_action(){
"use strict";
jQuery('.delete_invoice').on('click',function (){
var invoice_id, ajaxurl, acesta, booking_id;
booking_id=jQuery(this).attr('data-bookid');
invoice_id=jQuery(this).attr('data-invoiceid');
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
acesta=jQuery(this);
jQuery(this).empty().html('deleting...');
var nonce=jQuery('#wprentals_bookings_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_delete_invoice',
'invoice_id':invoice_id,
'booking_id':booking_id,
'security':nonce,
},
success: function (data){
var book_id=acesta.parent().find('.delete_booking').attr('data-bookid');
acesta.parent().find('.waiting_payment').after('
' + dashboard_vars.issue_inv1 + ' ');
acesta.parent().find('.waiting_payment').remove();
acesta.remove();
wpestate_create_generate_invoice_action();
},
error: function (errorThrown){
}});
});
}
function wpestate_calculate_deposit_js(book_down,book_down_fixed_fee,total_amm_compute){
var deposit;
if(book_down_fixed_fee===0){
deposit=(total_amm_compute * book_down / 100);
deposit=Math.round(deposit * 100) / 100;
}else{
deposit=book_down_fixed_fee;
}
return deposit;
}
function wpestate_invoice_create_js(){
"use strict";
jQuery('#add_inv_expenses,#add_inv_discount').on('click',function (){
var acesta=jQuery(this);
wpestate_recreate_invoice_manual_expenses(acesta);
});
function wpestate_delete_expense_js(){
"use strict";
jQuery(".delete_exp").unbind("click");
jQuery('.delete_exp').on('click',function (event){
var acesta=jQuery(this);
wpestate_recreate_invoice_manual_expenses(acesta);
});
};
function wpestate_recreate_invoice_manual_expenses(butonul){
var inv_service_fee_fixed,extra_guests,is_remove,taxes_value,security_dep,early_bird_percent,invoice_manual_extra,invoice_default_extra,inter_price,early_bird,inv_depozit,inv_balance,youearned,inv_service_fee,inv_taxes,book_down_fixed_fee,ex_name, ex_value, ex_value_show, new_row, total_amm, deposit, balance, book_down, cleaning_fee, city_fee, total_amm_compute,include_expenses;
is_remove=0;
ex_name=jQuery('#inv_expense_name').val();
ex_value=parseFloat(jQuery('#inv_expense_value').val());
if(butonul.is('#add_inv_discount')){
ex_name=dashboard_vars.discount;
ex_value=parseFloat(jQuery('#inv_expense_discount').val(), 10)*(-1);
}
if(butonul.hasClass('delete_exp')){
is_remove=1;
ex_name='nothng';
ex_value=parseFloat(butonul.attr('data-delvalue'))*-1;
}
include_expenses=butonul.attr('data-include_ex');
if(dashboard_vars.where_currency_symbol==='before'){
ex_value_show=dashboard_vars.currency_symbol + ' ' + '
'+ex_value+' ';
}else{
ex_value_show='
'+ex_value +' ' + ' ' + dashboard_vars.currency_symbol;
}
total_amm=parseFloat(jQuery('#total_amm').attr('data-total'));
cleaning_fee=parseFloat(jQuery('#cleaning-fee').attr('data-cleaning-fee'));
city_fee=parseFloat(jQuery('#city-fee').attr('data-city-fee'));
early_bird=parseFloat(jQuery('#erarly_bird_row').attr('data-val'));
inv_depozit=parseFloat(jQuery('#inv_depozit').attr('data-val'));
inv_balance=parseFloat(jQuery('#inv_balance').attr('data-val'));
youearned=parseFloat(jQuery('#youearned').attr('data-youearned'));
inv_service_fee=parseFloat(jQuery('#inv_service_fee').attr('data-value'));
inv_taxes=parseFloat(jQuery('#inv_taxes').attr('data-value'));
inter_price=parseFloat(jQuery('#inter_price').attr('data-value'));
security_dep=parseFloat(jQuery('#security_depozit_row').attr('data-val'));
early_bird_percent=parseFloat(jQuery('#property_details_invoice').attr('data-earlyb'));
taxes_value=parseFloat(jQuery('#property_details_invoice').attr('data-taxes_value'));
extra_guests=parseFloat(jQuery('#extra-guests').attr('data-extra-guests'));
invoice_default_extra=0;
jQuery('.invoice_default_extra').each(function(){
invoice_default_extra=invoice_default_extra + parseFloat(jQuery(this).attr('data-value'));
});
invoice_manual_extra=ex_value;
jQuery('.invoice_manual_extra').each(function(){
invoice_manual_extra=invoice_manual_extra + parseFloat(jQuery(this).attr('data-value'));
});
if(isNaN(cleaning_fee)){
cleaning_fee=0;
}
if(isNaN(city_fee)){
city_fee=0;
}
if(isNaN(extra_guests)){
extra_guests=0;
}
if(isNaN(early_bird)){
early_bird=0;
}
if(isNaN(inv_taxes)){
inv_taxes=0;
}
if(isNaN(inv_service_fee_fixed)){
inv_service_fee_fixed=0;
}
if(isNaN(youearned)){
youearned=0;
}
if(isNaN(inter_price)){
inter_price=0;
}
if(isNaN(security_dep)){
security_dep=0;
}
if(ex_name!==''&&ex_value!==''&&ex_name!==0&&ex_value!==0&&!isNaN(ex_value)){
if(is_remove==1){
butonul.parent().remove();
}else{
new_row='
' + ex_name + '
';
jQuery('.invoice_total').before(new_row);
jQuery('#inv_expense_name').val('');
jQuery('#inv_expense_value').val('');
jQuery('#inv_expense_discount').val('');
}
if(early_bird > 0){
early_bird=(inter_price+invoice_default_extra +invoice_manual_extra+extra_guests)*early_bird_percent/100;
}
var service_fee=parseFloat(dashboard_vars.service_fee);
inv_service_fee_fixed=parseFloat(dashboard_vars.service_fee_fixed_fee);
total_amm=(inter_price+invoice_default_extra +invoice_manual_extra+extra_guests) -early_bird +city_fee +cleaning_fee+security_dep;
if(parseFloat(inv_service_fee_fixed,10) > 0){
inv_service_fee=parseFloat(inv_service_fee_fixed);
}else{
inv_service_fee=(total_amm -security_dep -city_fee-cleaning_fee)*service_fee/100;
}
youearned=total_amm-security_dep-city_fee-cleaning_fee-inv_service_fee;
youearned=Math.round(youearned * 100) / 100;
inv_taxes=youearned*taxes_value/100;
inv_taxes=Math.round(inv_taxes * 100) / 100;
book_down=parseFloat(dashboard_vars.book_down);
book_down_fixed_fee=parseFloat(dashboard_vars.book_down_fixed_fee);
if(include_expenses==='yes'){
deposit=wpestate_calculate_deposit_js(book_down,book_down_fixed_fee,total_amm);
}else{
deposit=wpestate_calculate_deposit_js(book_down,book_down_fixed_fee,(total_amm-city_fee-cleaning_fee));
}
deposit=Math.round(deposit * 100) / 100;
balance=total_amm - deposit;
balance=Math.round(balance * 100) / 100;
wpestate_delete_expense_js();
jQuery('#total_amm').attr('data-total', total_amm);
if(dashboard_vars.where_currency_symbol==='before'){
jQuery('#inv_depozit').empty().html(dashboard_vars.currency_symbol + ' ' + deposit);
jQuery('#inv_depozit').attr('data-value',deposit);
jQuery('#inv_balance').empty().html(dashboard_vars.currency_symbol + ' ' + balance);
jQuery('#total_amm').empty().append(dashboard_vars.currency_symbol + ' ' + total_amm);
jQuery("#youearned").attr('data-value',youearned);
jQuery("#youearned").empty().html(dashboard_vars.currency_symbol + ' ' + youearned);
jQuery("#inv_service_fee").attr('data-value',inv_service_fee);
jQuery("#inv_service_fee").empty().html(dashboard_vars.currency_symbol + ' ' + inv_service_fee);
jQuery("#inv_taxes").attr('data-value',inv_taxes);
jQuery("#inv_taxes").empty().html(dashboard_vars.currency_symbol + ' ' + inv_taxes);
jQuery("#erarly_bird_row").attr('data-value',early_bird);
jQuery("#erarly_bird_row inv_data_value").attr('data-clearprice',early_bird);
jQuery("#erarly_bird_row").empty().html(dashboard_vars.currency_symbol + '
'+early_bird+' ');
}else{
jQuery('#inv_depozit').empty().html(deposit + ' ' + dashboard_vars.currency_symbol);
jQuery('#inv_depozit').attr('data-value',deposit);
jQuery('#inv_balance').empty().html(balance + ' ' + dashboard_vars.currency_symbol);
jQuery('#total_amm').empty().append(total_amm + ' ' + dashboard_vars.currency_symbol);
jQuery("#youearned").attr('data-value',youearned);
jQuery("#youearned").empty().html(youearned+ ' '+ dashboard_vars.currency_symbol);
jQuery("#inv_service_fee").attr('data-value',inv_service_fee);
jQuery("#inv_service_fee").empty().html(inv_service_fee+ ' '+ dashboard_vars.currency_symbol);
jQuery("#inv_taxes").attr('data-value',inv_taxes);
jQuery("#inv_taxes").empty().html(inv_taxes + ' '+ dashboard_vars.currency_symbol);
jQuery("#erarly_bird_row").attr('data-value',early_bird);
jQuery("#erarly_bird_row inv_data_value").attr('data-clearprice',early_bird);
jQuery("#erarly_bird_row").empty().html('
'+early_bird+' '+ dashboard_vars.currency_symbol);
}}
}
jQuery('#invoice_submit').on('click',function (){
var is_available,is_confirmed,parent, nonce, ajaxurl, bookid, price, details, details_item, manual_expenses_item,manual_expenses,acesta, to_be_paid,youearned;
details=new Array();
manual_expenses=new Array();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
bookid=jQuery(this).attr('data-bookid');
is_confirmed=jQuery(this).attr('data-is_confirmed');
price=parseFloat(jQuery('#total_amm').attr('data-total'));
youearned=parseFloat(jQuery('#youearned').attr('data-youearned'));
parent=jQuery(this).parent().parent().prev();
acesta=jQuery(this);
to_be_paid=parseFloat(jQuery('#inv_depozit').attr('data-value'));
jQuery(this).text(control_vars.pls_wait);
jQuery('.invoice_content').each(function (){
details_item=new Array();
details_item[0]=jQuery(this).find('.inv_legend').text();
details_item[1]=jQuery(this).find('.inv_data_value').attr('data-clearprice');
details_item[2]=jQuery(this).find('.inv_data_exp').text();
details.push(details_item);
});
jQuery('.manual_ex').each(function (){
manual_expenses_item=new Array();
manual_expenses_item[0]=jQuery(this).find('.inv_legend').text();
manual_expenses_item[1]=jQuery(this).find('.inv_data_value').attr('data-clearprice');
manual_expenses_item[2]=jQuery(this).find('.inv_data_exp').text();
manual_expenses.push(manual_expenses_item);
});
nonce=jQuery('#security-create_invoice_ajax_nonce').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_add_booking_invoice',
'bookid':bookid,
'price':price,
'details':details,
'manual_expenses':manual_expenses,
'to_be_paid':to_be_paid,
'youearned':youearned,
'is_confirmed':is_confirmed,
'security':nonce
},
success: function (data){
if(data==='stop'){
jQuery('.alert_error').remove();
acesta.before('
'+dashboard_vars.doublebook+' ');
}else{
parent.find('.invoice_list_id').html(data);
if(is_confirmed!==1&&is_confirmed!=='1'){
parent.find('.generate_invoice').after('
' + dashboard_vars.delete_inv + ' ');
}
parent.find('.generate_invoice').after('
' + dashboard_vars.issue_inv + ' ');
parent.find('.generate_invoice').remove();
parent.find('#inv_new_price').empty().append(price);
jQuery('.create_invoice_form').remove();
wpestate_create_delete_invoice_action();
}},
error: function (errorThrown){
}});
});
jQuery('#direct_confirmation').on('click',function (){
var parent, nonce, ajaxurl, bookid, price, details, acesta, details_item;
details=new Array();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
bookid=jQuery(this).attr('data-bookid');
price=jQuery('#total_amm').attr('data-total');
parent=jQuery(this).parent().parent().prev();
acesta=jQuery(this);
nonce=jQuery('#security-create_invoice_ajax_nonce').val();
jQuery('.invoice_content').each(function (){
details_item=new Array();
details_item[0]=jQuery(this).find('.inv_legend').text();
details_item[1]=jQuery(this).find('.inv_data_value').attr('data-clearprice');
details_item[2]=jQuery(this).find('.inv_data_exp').text();
details.push(details_item);
});
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_add_booking_invoice',
'bookid':bookid,
'price':price,
'details':details,
'security':nonce
},
success: function (data){
if(data==="doublebook"){
acesta.after('
'+dashboard_vars.doublebook+'
');
acesta.remove();
}else{
parent.find('.generate_invoice').after('
' + dashboard_vars.confirmed + ' ');
parent.find('.generate_invoice').remove();
parent.find('.delete_booking').remove();
jQuery('.create_invoice_form').remove();
}},
error: function (errorThrown){
}});
});
}
function wpestate_create_payment_action(){
"use strict";
jQuery('#confirm_zero_instant_booking').on('click',function (){
var ajaxurl,pay_paypal, prop_id, book_id, invoice_id, is_featured, is_upgrade,depozit;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
prop_id=jQuery(this).attr('data-propid');
book_id=jQuery(this).attr('data-bookid');
invoice_id=jQuery(this).attr('data-invoiceid');
depozit=jQuery(this).attr('data-deposit');
jQuery(this).text(control_vars.pls_wait);
var nonce=jQuery('#wprentals_confirm_zero_instant_booking').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_admin_activate_reservation_fee',
'book_id':book_id,
'invoice_id':invoice_id,
'security':nonce,
'is_zero_instant': 1
},
success: function (data){
window.open(control_vars.my_reservations_url, '_self', false);
},
error: function (errorThrown){
}});
});
jQuery('#paypal_booking').on('click',function (){
var pay_paypal, prop_id, book_id, invoice_id, is_featured, is_upgrade,depozit;
prop_id=jQuery(this).attr('data-propid');
book_id=jQuery(this).attr('data-bookid');
invoice_id=jQuery(this).attr('data-invoiceid');
depozit=jQuery(this).attr('data-deposit');
is_featured=0;
is_upgrade=0;
pay_paypal='
' + ajaxcalls_vars.paypal + '
';
jQuery('body').append(pay_paypal);
jQuery('#paypal_modal').modal();
wpestate_booking_cretupm_paypal(prop_id, book_id, invoice_id,depozit);
});
jQuery('#direct_pay_booking').on('click',function (){
var pay_paypal, prop_id, book_id, invoice_id, is_featured, is_upgrade;
prop_id=jQuery(this).attr('data-propid');
book_id=jQuery(this).attr('data-bookid');
invoice_id=jQuery(this).attr('data-invoiceid');
is_featured=0;
is_upgrade=0;
wpestate_enable_booking_direct_pay(prop_id,book_id,invoice_id);
});
jQuery('.woo_pay').on('click',function (){
var pay_paypal, prop_id, book_id, invoice_id, is_featured, is_upgrade,ajaxurl,depozit,is_submit;
prop_id=jQuery(this).attr('data-propid');
book_id=jQuery(this).attr('data-bookid');
invoice_id=jQuery(this).attr('data-invoiceid');
depozit=jQuery(this).attr('data-deposit');
is_featured=0;
is_upgrade=0;
is_submit=0;
if(jQuery(this).hasClass('woo_pay_submit')){
is_submit=1;
}
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_woo_pay',
'invoiceid':invoice_id,
'propid':prop_id,
'book_id':book_id,
'depozit':depozit,
'is_submit':is_submit
},
success: function (data){
if(data!==false){
window.location.href=dashboard_vars.checkout_url;
}},
error: function (errorThrown){}});
});
jQuery('#wpestate_stripe_booking').on('click',function(){
var modalid=jQuery(this).attr('data-modalid');
jQuery('#'+modalid).show();
jQuery('#'+modalid+' .wpestate_stripe_form_1').show();
wpestate_start_stripe(0,modalid);
});
jQuery('.close_stripe_form').on('click',function(){
jQuery('.wpestate_stripe_form_wrapper').hide();
jQuery('.wpestate_stripe_form_1').hide();
});
}
function wpestate_enable_booking_direct_pay(prop_id,book_id,invoice_id){
var is_full_pay,price_pack,direct_pay_modal, selected_pack,selected_prop,include_feat,attr, price_pack;
if(jQuery("#is_full_pay").length==0){
price_pack=parseFloat(jQuery('.depozit_show').attr('data-value'),10);
}else{
price_pack=parseFloat(jQuery('#is_full_pay').val());
}
var float_price_pack=price_pack;
if(control_vars.where_curency==='after'){
price_pack=price_pack +' '+control_vars.submission_curency;
}else{
price_pack=control_vars.submission_curency+' '+price_pack;
}
price_pack=control_vars.direct_price+': '+price_pack;
if(selected_pack!==''){
window.scrollTo(0, 0);
direct_pay_modal='
'+price_pack+' '+control_vars.direct_pay+' '+control_vars.send_invoice+'
';
jQuery('body').append(direct_pay_modal);
jQuery('#direct_pay_modal').modal();
wpestate_enable_booking_direct_pay_button(float_price_pack);
}
jQuery('#direct_pay_modal').on('hidden.bs.modal', function (e){
jQuery('#direct_pay_modal').remove();
})
}
function wpestate_enable_booking_direct_pay_button(price_pack){
jQuery('#send_direct_bill_booking').unbind('click');
jQuery('#send_direct_bill_booking').on('click',function(){
jQuery('#send_direct_bill_booking').unbind('click');
var invoiceid,ajaxurl,propid,book_id;
invoiceid=jQuery(this).attr('data-invoiceid');
propid=jQuery(this).attr('data-propid')
book_id=jQuery(this).attr('data-bookid')
ajaxurl=ajaxcalls_vars.admin_url + 'admin-ajax.php';
var nonce=jQuery('#wprentals_reservation_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_direct_pay_booking',
'invoiceid':invoiceid,
'propid':propid,
'book_id':book_id,
'price_pack':price_pack,
'security':nonce,
},
success: function (data){
jQuery('#send_direct_bill_booking').hide();
jQuery('#direct_pay_modal .listing-submit span:nth-child(2)').empty().html(control_vars.direct_thx);
},
error: function (errorThrown){}});
});
}
function wpestate_booking_cretupm_paypal(prop_id, book_id, invoice_id,depozit){
"use strict";
var ajaxurl=control_vars.admin_url + 'admin-ajax.php';
var nonce=jQuery('#wprentals_reservation_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_ajax_booking_pay',
'propid':prop_id,
'bookid':book_id,
'invoice_id':invoice_id,
'depozit':depozit,
'security':nonce
},
success: function (data){
window.location.href=data;
},
error: function (errorThrown){
}});
}
function filter_invoices(){
"use strict";
var ajaxurl, start_date, end_date, type, status;
start_date=jQuery('#invoice_start_date').val();
if(start_date!==''){
start_date=wpestate_convert_selected_days(start_date);
}
end_date=jQuery('#invoice_end_date').val();
if(end_date!==''){
end_date=wpestate_convert_selected_days(end_date);
}
type=jQuery('#invoice_type').val();
status=jQuery('#invoice_status').val();
var nonce=jQuery('#wprentals_invoice_pace_actions').val();
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
jQuery.ajax({
type: 'POST',
url: ajaxurl,
dataType: 'json',
data: {
'action':'wpestate_ajax_filter_invoices',
'start_date':start_date,
'end_date':end_date,
'type':type,
'status':status,
'security':nonce,
},
success: function (data){
jQuery('#container-invoices').empty().append(data.results);
jQuery('#invoice_issued').empty().append(data.invoice_issued);
jQuery('#invoice_confirmed').empty().append(data.invoice_confirmed);
wpestate_enable_invoice_actions();
},
error: function (errorThrown){
}});
}
function wpestate_enable_invoice_actions(){
jQuery('.invoice_unit').on('click',function (){
var invoice_id, booking_id, ajaxurl, acesta, parent;
booking_id=jQuery(this).attr('data-booking-confirmed');
invoice_id=jQuery(this).attr('data-invoice-confirmed');
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
acesta=jQuery(this);
parent=jQuery(this);
var nonce=jQuery('#wprentals_invoice_pace_actions').val();
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'wpestate_show_invoice_dashboard',
'invoice_id':invoice_id,
'booking_id':booking_id,
'security':nonce
},
success: function (data){
jQuery('.create_invoice_form').remove();
parent.append(data);
wpestate_create_payment_action();
create_print_action();
},
error: function (errorThrown){
}});
});
}
function create_print_action(){
jQuery('#print_invoice').on('click',function(event){
var myWindow, ajaxurl;
ajaxurl=control_vars.admin_url + 'admin-ajax.php';
event.preventDefault();
var invoice_id=jQuery(this).attr('data-invoice_id');
var nonce=jQuery('#wprentals_print_invoice').val();
myWindow=window.open('','Print Me','width=700 ,height=842');
jQuery.ajax({
type: 'POST',
url: ajaxurl,
data: {
'action':'ajax_create_print',
'invoice_id':invoice_id,
'security':nonce
},
success:function(data){
myWindow.document.write(data);
myWindow.document.close();
myWindow.focus();
},
error: function(errorThrown){
}});
});
}
function wprentals_show_static_calendar_backend(){
if(typeof (dashboard_vars2)==='undefined'){
return;
}
if(jQuery("#all-front-calendars_per_hour_internal").length >0){
var today=new Date();
var start_temp='';
var listing_book_dates=[];
var booking_array=[];
if(dashboard_vars2.booking_array!==''&&dashboard_vars2.booking_array.length!==0){
booking_array=JSON.parse (dashboard_vars2.booking_array);
}
for (var key in booking_array){
if(booking_array.hasOwnProperty(key)&&key!==''){
var temp_book=[];
temp_book['title']=dashboard_vars.reserved;
temp_book ['start']=moment.unix(key).utc().format();
temp_book ['end']=moment.unix(booking_array[key]).utc().format();
temp_book ['editable']=false;
listing_book_dates.push(temp_book);
}}
jQuery("#all-front-calendars_per_hour_internal").fullCalendar({
defaultView: 'agendaWeek',
navLinks: false,
defaultDate: today,
selectable:false,
selectHelper:true,
selectOverlap :false,
footer:false,
slotDuration:'01:00:00',
allDayText:'hours',
weekNumbers: false,
weekNumbersWithinDays: true,
weekNumberCalculation: 'ISO',
editable: false,
eventLimit: true,
unselectAuto:false,
isRTL:control_vars.rtl_book_hours_calendar,
header: {
left: 'prev,next today',
center: 'title',
right: ''
},
minTime:control_vars.booking_start_hour,
maxTime:control_vars.booking_end_hour,
events: listing_book_dates
});
}}
function wpestate_show_bedrooms_input_trigger(){
var array_feeds=[];
jQuery('#property_bedrooms').on('change',function(event){
var bedrooms_no=parseInt(jQuery(this).val());
var beds_options_string=jQuery('#beds_options_string').val();
console.log(beds_options_string);
wpestate_show_bedrooms_input(bedrooms_no, (beds_options_string));
});
}
function wpestate_show_bedrooms_input(bedrooms_no,saved_values){
jQuery('#whole_beds_wrapper').remove();
var bed_types=dashboard_vars.bed_types
var bed_types_array=Object.keys(bed_types).map(function (key){
return [ bed_types[key]];
});
console.log(bed_types);
console.log(bed_types_array);
console.log(dashboard_vars.bed_types_names);
saved_values=JSON.parse(saved_values);
var to_insert='
';
var index;
var i=0;
var j=0;
var display_value=0;
var toshow='';
while(i
0){
toshow=' style="display:none" ';
}
to_insert=to_insert+'Bedroom '+(i+1)+' open/close
';
}
to_insert=to_insert + ' ';
jQuery('#property_bedrooms_wrappr').after(to_insert);
wpestate_toogle_beds();
}
function wpestate_toogle_beds(){
jQuery('.beds_wrapper_control').on('click',function(){
var acesta=jQuery(this).parent();
acesta.find('.bedroom_input_val_wrapper').slideToggle();
});
};
!function(d,l){"use strict";var e=!1,o=!1;if(l.querySelector)if(d.addEventListener)e=!0;if(d.wp=d.wp||{},!d.wp.receiveEmbedMessage)if(d.wp.receiveEmbedMessage=function(e){var t=e.data;if(t)if(t.secret||t.message||t.value)if(!/[^a-zA-Z0-9]/.test(t.secret)){var r,a,i,s,n,o=l.querySelectorAll('iframe[data-secret="'+t.secret+'"]'),c=l.querySelectorAll('blockquote[data-secret="'+t.secret+'"]');for(r=0;r